egg-upyun

1.0.6 • Public • Published

egg-upyun

currently only supports server access Authorization, and then USES the client (android/ios) to get the key to upload.

NPM version build status Test coverage David deps Known Vulnerabilities npm download

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.

License

MIT

Package Sidebar

Install

npm i egg-upyun

Weekly Downloads

0

Version

1.0.6

License

MIT

Unpacked Size

7.92 kB

Total Files

7

Last publish

Collaborators

  • micahchiu