@eternaljs/captcha
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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

Package Sidebar

Install

npm i @eternaljs/captcha

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

9.61 kB

Total Files

11

Last publish

Collaborators

  • gchandrasekhar