npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jacket-captcha

v1.0.6

Published

A captcha that develop by Jacket Chen.

Downloads

4

Readme

jacket-captcha

A captcha that develop by Jacket Chen..

Sample

The generated captcha image looks like this: alt tag

Usage

First, install jacket-captcha.

npm install jacket-captcha

jacket-captcha depend on node-canvas, install node-canvas you'll need Cairo. For system-specific installation view the Wiki.

You can quickly install the dependencies by using the command for your OS:

OS | Command ----- | ----- OS X | brew install pkg-config cairo libpng jpeg giflib Ubuntu | sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++ Fedora | sudo yum install cairo cairo-devel cairomm-devel libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel giflib-devel Solaris | pkgin install cairo pkg-config xproto renderproto kbproto xextproto Windows | Instructions on wiki

El Capitan users: If you have recently updated to El Capitan and are experiencing trouble when compiling, run the following command: xcode-select --install. Read more about the problem on Stack Overflow.

After you sucessfully install jacket-captcha, use it in your node app:

// require library
var captcha = require('jacket-captcha');

// configure and create a captcha image
var captchaObj = captcha.config({
    width: 70,      // image's width
    height: 35,     // image's height
    lineNumber: 6,  // the number of lines that would be drawn into the image in case of prevent the program automatically discern the code on the image
    charNumber: 4   // the length of code
}).create();

// get the captcha code
var code = captchaObj.code;

// get the base64 url of the captcha image
var base64URL = captchaObj.base64URL;

// save the captcha image, you could specify the image's name and where to store it
captchaObj.save({
  dirname: 'a/b/c',
  filename: 'captcha'
});

// Do something...

API

require jacket-captcha will return a captcha instance.

Captcha#config(options)

Return: Object This method will return the captcha instance.

options

Type: Object The configuration of the captcha instance.

options.width

Type: Number Config the width of the captcha image.

options.height

Type: Number Config the height of the captcha image.

options.lineNumber

Type: Number Config the number of lines that would be drawn into the image in case of prevent the program automatically discern the code on the image.

options.charNumber

Type: Number Config the length of code.

Captcha#create()

Return: Object Create a captcha image. This method will return the captcha image instance.

Captcha#getCode()

Return: String Get the captcha code. This method will return the captcha code that generated by the method of Captcha#create().

Captcha#getBase64URL()

Return: String Get the base64 url of the captcha image. This mehod will return the base64 url of the captcha image that generated by the method of Captcha#create().

Captcha#save(options)

options

Type: Object Specify the name of the saved image and where to store it.

options.dirname

Type: String The directory where to store the image.

options.filename

Type: String The name of the saved image.