Socket
Socket
Sign inDemoInstall

akos-egg-nos

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

akos-egg-nos

[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][codecov-image]][codecov-url] [![David deps][david-image]][david-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![npm download][download-image]][down


Version published
Maintainers
2
Created
Source

akos-egg-nos

NPM version npm download

Install

$ npm i akos-egg-nos --save

Usage

// {app_root}/config/plugin.js
exports.nos = {
  enable: true,
  package: 'akos-egg-nos',
};

Configuration

// {app_root}/config/config.default.js
exports.nos = {
  accessId: '', // accessId
  secretId: '', // secretId
  endpoint: '', // eg:nos-eastchina1.126.net
  bucket: '', // testnos
  port: '', // eg: 80, 443
  rmFile: '',// 是否删除上报源文件
};

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

Example

// 上传文件至nos
 const result = await this.app.nos.uploadFile(__dirname + '/home.js');
返回:
{
    "code":200,
    "result":{
        "statusCode":200,
        "headers":{
            "date":"Wed, 22 Jan 2020 03:09:52 GMT",
            "content-type":"text/plain",
            "content-length":"0",
            "connection":"close",
            "x-nos-request-id":"b0f88003-f2cb-4a46-a01e-cfd7acede85f",
            "x-nos-requesttype":"PutObject",
            "x-nos-object-name":"test_dfb57d12fe50453ca10e9ae06ef6d643.txt",
            "etag":"c8e0a8b69178a6f9c8f2d926be0aff18",
            "x-nos-storage-class":"STANDARD",
            "server":"nos/v1.0.0"
        },
        "file_key":"test_dfb57d12fe50453ca10e9ae06ef6d643.txt"
    },
    "requestId":"39c4031d-15c7-4e6f-bf8a-4d43a86e1f91",
    "machine":"lgfshrdeMacBook-Pro.local"
}
// 获取文件地址
 const key = 'test_358.txt';
 const result = this.app.nos.getPrivateObjectUrl('testnos', key, 10 * 60 * 1000);
 eg: result-> https://testnos.nos-eastchina1.126.net/test_358.txt?Signature=xxx&Expires=1579662403&NOSAccessKeyId=xxx

Questions & Suggestions

Please open an issue here.

License

MIT

Keywords

FAQs

Package last updated on 10 Mar 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc