moleculer-s3
TypeScript icon, indicating that this package has built-in type declarations

0.1.7 • Public • Published

moleculer-s3

Moleculer Service Mixin for S3

Use mixin in the service

const S3 = require('moleculer-s3')

module.exports = {
  name: 's3',
  settings: {
    provider: 'aws', // aws | digitalocean | bizfly
    accessKeyId: '', // process.env.S3_ACCESS_KEY_ID
    secretAccessKey: // process.env.S3_SECRET_ACCESS_KEY
    region: '', // process.env.S3_REGION
    endpoint: '', // process.env.S3_ENDPOINT if you provide `provider` option, don't need to provide endpoint
    cdn: // process.env.S3_CDN,
    bucket: // process.env.S3_BUCKET,
  },
  mixins: [S3('aws')], // if provided `provider` in `settings` -> you don't need to provide here
}

Actions

getSignedUrl

Params:

{
  location: 'string',
  expiry: 'number|integer|optional',
  type: {
    type: 'array',
    items: 'string',
    enum: ['getObject', 'putObject'],
    optional: true,
    default: 'getObject',
  },
}

Call from other service

ctx.call('s3.getSignedUrl', { location: '/path/to/file/in/bucket' })
// { location: '/path/to/file', expiry: 60 * 1, type: 'putObject' }

Response

{
  signedUrl: '',
  raw: ''
}

Readme

Keywords

none

Package Sidebar

Install

npm i moleculer-s3

Weekly Downloads

2

Version

0.1.7

License

MIT

Unpacked Size

28.3 kB

Total Files

25

Last publish

Collaborators

  • lucduong