Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eggplugin/s3

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eggplugin/s3

AWS S3 plugin for Egg

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-77.27%
Maintainers
1
Weekly downloads
 
Created
Source

egg-aws-s3

AWS-S3 plugin for Egg.js

NOTE: This plugin just for integrate AWS-S3 into Egg.js, more documentation please visit https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html.

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

AWS S3 plugin for Egg

Install

$ npm i @eggplugin/s3 --save

Configuration

// {app_root}/config/plugin.js
exports.s3 = {
  enable: true,
  package: '@eggplugin/s3',
};

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

Simple instance

// {app_root}/config/config.default.js
exports.s3 = {
  client: {
    accessKeyId: '',
    secretAccessKey: '',
    endpoint: '',
    // ...
  },
  // load into app, default is open
  app: true,
  // load into agent, default is close
  agent: false,
};

Usage:

(async () => {
  // you can access to simple aws s3 instance using app.s3.
  const s3 = app.s3;
  const data = await s3.listBuckets().promise();
  const buckets = data.Buckets.map(item => item.Name);
  console.log(buckets);
}).catch(console.error);

Multiple instance

exports.s3 = {
  // default configuration for all clients
  default: {
    // endpoint: '',
    // s3ForcePathStyle: '',
    // maxRetries: '',
    // sslEnabled: '',
    // apiVersion: '',
    // signatureVersion: '',
    // ...
  },
  clients: {
    // clientId, access the client instance by app.s3.get('clientId')
    client1: {
      accessKeyId: '',
      secretAccessKey: '',
      endpoint: '',
    // ...
    },
    client2: {
      accessKeyId: '',
      secretAccessKey: '',
      endpoint: '',
      // ...
    },
    // ...
  },
  // load into app, default is open
  app: true,
  // load into agent, default is close
  agent: false,
};

Usage:

(async () => {
  const client1 = app.s3.get('client1'); 
  const client2 = app.s3.get('client2'); 
  const data1 = await client1.listBuckets().promise();
  const data2 = await client2.listBuckets().promise();
}).catch(console.error);

Questions & Suggestions

Please open an issue here.

License

MIT

Keywords

FAQs

Package last updated on 15 Dec 2019

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