2.0.0 • Published 1 year ago

nastaliq-captcha v2.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Nastaliq Captcha

A simple offline captcha in persian.

How to install

npm install --save nastaliq-captcha

How to use :

const express = require("express");
const Buffer = require("buffer").Buffer;
const { createCaptcha } = require("nastaliq-captcha");

const app = express();
const port = 4000;

app.get("/captcha", (req, res) => {
  const captcha = createCaptcha({
    width: 150,
    height: 50,
    from: 100,
    to: 999,
    lines: 3,
  });
  const number = captcha.number; // You can store it in a session and compare with user answer
  const image = new Buffer(captcha.image, "base64");

  res.writeHead(200, {
    "Content-Type": "image/png",
    "Content-Length": image.length,
  });

  res.end(image);
});

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`);
});

Output :

captcha

2.0.0

1 year ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.2

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago