Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nidrux/simple-captcha-generator
Generate a simple captcha string and or captcha image.
https://github.com/nidrux/simple-captcha-generator
captcha captcha-generator captcha-image javascript nodejs npm-package simple
Last synced: about 1 month ago
JSON representation
Generate a simple captcha string and or captcha image.
- Host: GitHub
- URL: https://github.com/nidrux/simple-captcha-generator
- Owner: Nidrux
- Created: 2021-07-06T00:42:46.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-11T17:00:26.000Z (almost 3 years ago)
- Last Synced: 2024-03-23T02:46:55.894Z (8 months ago)
- Topics: captcha, captcha-generator, captcha-image, javascript, nodejs, npm-package, simple
- Language: JavaScript
- Homepage:
- Size: 510 KB
- Stars: 8
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### InstallationType `npm i simple-captcha-generator` in your cmd to install the package
#### create captcha:
```js
const { Captcha } = require("simple-captcha-generator");
const captcha = new Captcha();
```### Usage:
```js
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.
```js
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
```js
captcha.image(captcha.currentString) //Return image buffer of current generated string
```
### Example images: