forked from postman/itriton-captcha
✨ 优化文档
This commit is contained in:
parent
87825f7635
commit
2d7f5929a4
14
README.md
14
README.md
|
@ -10,15 +10,25 @@
|
|||
```
|
||||
const captcha = require('@itriton/captcha')
|
||||
|
||||
// 默认
|
||||
// 默认(promise)
|
||||
captcha.create().then(res=>{
|
||||
console.log(res)
|
||||
})
|
||||
|
||||
// 自定义参数
|
||||
// 自定义参数(promise)
|
||||
captcha.create(options).then(res=>{
|
||||
console.log(res)
|
||||
})
|
||||
|
||||
// 默认(async/await)
|
||||
async function captcha(){
|
||||
const result = await captcha.create()
|
||||
}
|
||||
|
||||
// 自定义参数(async/await)
|
||||
async function captcha(){
|
||||
const result = await captcha.create(options)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
|
1
index.js
1
index.js
|
@ -16,6 +16,7 @@ const create = async function (options) {
|
|||
const left = randomRangeNum(size, width - size);
|
||||
const top = randomRangeNum(size, height - size);
|
||||
const border = 1;
|
||||
|
||||
// Generate Jigsaw Image
|
||||
const jigsawBaseImage = await sharp(baseImage)
|
||||
.extract({ left: 0, top: top, width: size, height: size })
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@itriton/captcha",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"description": "生成滑动验证码拼图图片和背景图片",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in New Issue