forked from GeorgeChan/captchapng
-
Notifications
You must be signed in to change notification settings - Fork 4
/
package.json
26 lines (26 loc) · 1.73 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
"name": "captchapng",
"version": "0.0.1",
"description": "A numeric captcha generator for Node.js",
"author": {
"name": "George Chan"
},
"main": "./lib/captchapng.js",
"repository": {
"type": "git",
"url": "https://github.com/GeorgeChan/captchapng"
},
"keywords": [
"captchapng"
],
"dependencies": {
"cors": "^2.8.5",
"express": "^4.17.1",
"lowdb": "^1.0.0",
"pnglib": "0.0.1",
"uuid": "^8.3.2"
},
"license": "BSD",
"readme": "#Captcha PNG generator\nA numeric captcha generator for Node.js\n\n##Features\n* Only generate numeric captcha PNG image\n* Build-in fonts\n* Characters up and down, left and right limits, random displacement\n* Full JavaScript\n\n##Examples\n```javascript\n/**\n * Captcha PNG img generator\n * @Author: George Chan\n * @Email: [email protected]\n * @Version: 1.0\n * @Date: 2013-08-18\n * @license http://www.opensource.org/licenses/bsd-license.php BSD License\n */\n\nvar http = require('http');\nvar captchapng = require('captchapng');\n\nhttp.createServer(function (request, response) {\n if(request.url == '/captcha.png') {\n var p = new captchapng(80,30,parseInt(Math.random()*9000+1000)); // width,height,numeric captcha\n p.color(0, 0, 0, 0); // First color: background (red, green, blue, alpha)\n p.color(80, 80, 80, 255); // Second color: paint (red, green, blue, alpha)\n\n var img = p.getBase64();\n var imgbase64 = new Buffer(img,'base64');\n response.writeHead(200, {\n 'Content-Type': 'image/png'\n });\n response.end(imgbase64);\n } else response.end('');\n}).listen(8181);\n\nconsole.log('Web server started.\\n http:\\\\127.0.0.1:8181\\captcha.png');\n```",
"readmeFilename": "README.md"
}