1.0.6 • Published 3 years ago

simple-captcha-generator v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

simple-captcha-generator

Generate a simple captcha string and or captcha image.

Type npm i simple-captcha-generator in your cmd to install the package

create captcha:

const { Captcha } = require("simple-captcha-generator");
const captcha = new Captcha();

Usage

const { Captcha }= require('simple-captcha-generator');
let captcha = new Captcha();


(async () => {
    console.log(captcha.currentString);
    console.log(await captcha.image(captcha.currentString));
})();

How to set string length?

You can have have a min length of 5 and a max length of 10. When no length is specified it will default to 5. Every length above 10 will default to 10.

const captcha = new Captcha(5);

Options

.currentString string

Returns a generated string with the given length Example: '0e6ji'

.length int

Returns the given length Example: 8

.image() Buffer

Returns and image buffer of the generated captcha (Promise so use await!) Usage

captcha.image(captcha.currentString) //Return image buffer of current generated string
1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago