1.1.1 • Published 7 years ago

egg-aws-s3 v1.1.1

Weekly downloads
28
License
MIT
Repository
github
Last release
7 years ago

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

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago