2.1.5 • Published 2 years ago
qiniu-tool-v2 v2.1.5
安装
npm install qiniu-tool-v2
yarn add qiniu-tool-v2
测试
npm run test
使用方法(仅限V2.0.0版本)
const {fetch, refresh, upload} = require('qiniu-tool-v2')
/**
* 上传资源
* 第一参数: 七牛配置参数
* 第二参数: file path/buffer/base64
* 第三参数: 上传后的CDN路径
*/
const result01 = await upload({
ak: '',
sk: '',
scope: '',
zone: '', // 七牛空间(默认Zone_z1)
}, '/Users/kyle/zhuangkai/qiniu-tool/test.png', 'test/2020-10-12/demo.png')
// 刷新资源
const result02 = await refresh({
ak: '',
sk: ''
}, [
'https://static.domain.com/demo01.png',
'https://static.domain.com/demo01.png'
])
// 拉取网络资源
const result03 = await fetch({
ak: '',
sk: '',
scope: '',
}, 'https://img2.domain.com/3ae0df90_400.png', 'test/tsUpload/aa2.png')