npm install naptcha bash
$ npm run build
`Run demo
` bash
$ npm run demo
`Installation
Install ImageMagick before install naptcha on Linux.` bash
$ apt-get install ImageMagick
`` bash
$ npm install naptcha
`Examples
express.js` javascript
var naptcha = require('naptcha').of();
app.get('/naptcha', function (req, res) {
var nap = naptcha.perform();
res.setHeader("Content-Type", "image/jpeg");
res.end(nap.bytes, 'binary');
});
`koa.js
` javascript
router.get('/naptcha', function* (req, resp) {
const nap = naptcha.perform();
this.session.naptcha = nap.text;
this.body = nap.bytes;
this.type = 'image/jpeg';
});
`Release History
* 1.3.1
* stable version
* 2.0.0
* change api for get image bytes by nap.bytes`