0.1.0 • Published 1 month ago

@eternaljs/captcha v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Captcha

The "captcha" npm package provides a straightforward solution for generating secure and customizable CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) images for use in web applications. CAPTCHAs are widely employed to prevent automated abuse, such as spamming or unauthorized access, by verifying that the user is a human rather than a bot.

Installing

Using npm:

$ npm install @eternaljs/captcha

Using yarn:

$ yarn add @eternaljs/captcha

Imports

These examples assume you're in node, or something similar:

// JavaScript
const generateCaptcha = require("@eternaljs/captcha");

// TypeScript
import * as generateCaptcha from "@eternaljs/captcha";

Usage Example

const captcha = generateCaptcha({ width: 180, height: 50 })
console.log(captcha.text); // Outputs a random alphanumeric code of the specified length
console.log(captcha.image.toBuffer()); // Returns an Image Buffer
console.log(captcha.image.toDataURL()); // Returns an Image base64 data url 

License

MIT