2.1.0 • Published 5 years ago

bragg-s3 v2.1.0

Weekly downloads
8
License
MIT
Repository
github
Last release
5 years ago

bragg-s3 Build Status

bragg middleware to process s3 triggers

Install

$ npm install bragg-s3

Routing

The routing is decided based on the event type

Event nameMethod
ObjectCreated:*post
ObjectCreated:Putpost
ObjectCreated:Postpost
ObjectCreated:Copypost
ObjectCreated:CompleteMultipartUploadpost
ObjectRemoved:*delete
ObjectRemoved:Deletedelete
ObjectRemoved:DeleteMarkerCreateddelete
ObjectRestore:Postpost
ObjectRestore:Completedpost
ReducedRedundancyLostObjectpost

Usage

const app = require('bragg')();
const router = require('bragg-router')();
const s3 = require('bragg-s3');

// Listen for events in the `TopicName` topic
router.post('s3:triggerName', ctx => {
    ctx.body = ctx.request.body; // [{bucket: 'someBucket', key: 'foo.jpg', eventName: 'ObjectCreated:Put'}]
});

app.use(s3());
app.use(router.routes());

exports.handler = app.listen();

The s3: prefix is added before the name of the S3 trigger. The bucket, key and eventName are provided in the body of the request object. Routing is decided by the configurationId provided in the request. This can be a UUID when the trigger is created using AWS CloudFormation.

API

braggS3()

Add the bragg S3 middleware to the middleware pipeline.

License

MIT © Simon

2.1.0

5 years ago

2.0.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago