egg-qiniu-upload
Install
$ npm i egg-qiniu-upload-token --save-dev
Usage
// {app_root}/config/plugin.jsexportsqiniu = enable: true package: 'egg-qiniu-upload-token';
Configuration
// {app_root}/config/config.default.jsexportsqiniu = // I ussually set the key into `~/.zshrc`, and I can get the value via `process.env.key`, It's very safe~ ak: 'your access key' sk: 'your secret key' bucket: 'yout bucket' baseUrl: 'your base url' zone: 'your zone' app: true // default value agent: false //default value;
see config/config.default.js for more detail, and more detail about qiniu please see the document
Example
upload file to qiniu and return the url and key
// {app_root}/app/service/file.jsasync { const app = this // do someting what you want to do........ return await appqiniu}/* return a Objet:{key:'your key',url:'your public url'}*/
get the file info by your file's key
// {app_root}/app/servcie/file.jsasync { // your should auth the user's passport. return await thisappqiniu;} async { return await thisappqiniu;}
more function ...
Questions & Suggestions
Please open an issue here.