egg-upyun
v1.0.6
Published
> currently only supports server access Authorization, and then USES the client (android/ios) to get the key to upload.
Downloads
74
Readme
egg-upyun
currently only supports server access Authorization, and then USES the client (android/ios) to get the key to upload.
Install
$ npm i egg-upyun --save
Usage
// {app_root}/config/plugin.js
exports.upyun = {
enable: true,
package: 'egg-upyun',
};
Configuration
// {app_root}/config/config.default.js
exports.upyun = {
name: 'The service name',
username: 'The operator',
password: 'Operator password',
cdnUrl: 'Speed up the domain',
};
see config/config.default.js for more detail.
Example
// {app_root}/XX.js
const paramData = {
bucket: config.upyun.name, // Upload the space service name.
expiration: parseInt(new Date().getTime() / 1000 + 60, 10), // The expiration date of the request.
'allow-file-type': 'jpg,jpeg,png,gif', // The file type
'content-length-range': '1,1024000',// File size
};
data = await app.upyun.getPolicyAndAuthorization(paramData);
Introduction
- this is a cloud service solution.
- simplified and patted the cloud API without worrying about memory leaks.
Questions & Suggestions
Please open an issue here.