New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@axolo/egg-cos

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axolo/egg-cos

Tencent Cloud COS plugin for Egg.js.

latest
Source
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

egg-cos

Tencent Cloud COS SDK plugin for Egg.js.

Install

npm i @axolo/egg-cos --save

Usage

// {app_root}/config/plugin.js
exports.cos = {
  enable: true,
  package: '@axolo/egg-cos',
};

Configuration

// {app_root}/config/config.default.js
exports.cos = {
  SecretId: 'COS_SECRETID',
  SecretKey: 'COS_SECRETKEY',
  Bucket: 'BUCKET-APPID',
  Region: 'COS_REGION', // e.g ap-shanghai
};

see config/config.default.js for more detail.

Example

Get file signature url from cos like http://localhost:7001/cos/logo.png.

const Controller = require('egg').Controller;

class CosController extends Controller {
  async show() {
    const { app, ctx } = this;
    const { id } = ctx.params;
    const res = await app.cos.signatureUrl(id);
    ctx.body = res;
  }
}

module.exports = CosController;

Questions & Suggestions

Please open an issue here.

License

MIT

Keywords

egg

FAQs

Package last updated on 20 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts