🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

captchapng2

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

captchapng2

A numeric captcha generator for Node.js

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
36
-5.26%
Maintainers
1
Weekly downloads
 
Created
Source

Lite PNG captcha generator

More faster and colorful version of captchapng. (2~3 faster than orginal)

Installation

npm install captchapng2

Examples

const http = require('http');
const captchapng = require('captchapng2');

http.createServer(function (req, res) {
  if(req.url == '/captcha.png') {
    let rand = parseInt(Math.random() * 9000 + 1000);
    let png = new captchapng(80, 30, rand); // width,height, numeric captcha

    res.writeHead(200, { 'Content-Type': 'image/png'});
    res.end(png.getBuffer());
  } else {
    res.end('');
  }
}).listen(8181);

console.log('Web server started.\nSee http:\\\\127.0.0.1:8181\\captcha.png');

output:

captcha

Keywords

captchapng

FAQs

Package last updated on 16 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts