egg-aws-s3

1.1.1 • Public • Published

egg-aws-s3

NPM version build status Test coverage David deps npm download

Install

$ npm i egg-aws-s3 --save

Usage

// {app_root}/config/plugin.js
exports.awsS3 = {
  enable: true,
  package: 'egg-aws-s3',
};

Configuration

// {app_root}/config/config.default.js
exports.awsS3 = {
  client: {
    convertAsync: true,  // plugin owner property, while this flag is true, s3 client object will add async function
    sslEnabled: false,
    s3ForcePathStyle: true,
    signatureVersion: 'v2',
  },
  app: true,
  agent: false,
};
 

see aws document contructor property for more client detail.

Example

app.awsS3.listBuckets({}, (err, data) => {
  if (err)
    console.log(err);
  console.log(data);
});
 
// while convertAsync is enable, you can use async/await like
try {
  const data = await app.awsS3.listBucketsAsync({});
  console.log(data);
} catch (err) {
  console.log(err);
}

see aws document method summary for APIs.

Questions & Suggestions

Please open an issue here.

License

MIT

Package Sidebar

Install

npm i egg-aws-s3

Weekly Downloads

7

Version

1.1.1

License

MIT

Unpacked Size

5.7 kB

Total Files

7

Last publish

Collaborators

  • mrrtree