s3-eventstore

0.1.0 • Public • Published

s3-eventstore

Stability: 1 - Experimental

Store events in S3.

Installation

npm install s3-eventstore

Tests

npm test

Overview

S3EventStore is a simple client to store events in an S3 bucket. It turns a JavaScript object into JSON and stores it under a unique key related to client time.

var S3EventStore = require('s3-eventstore');
var es = new S3EventStore({
    accessKeyId: "ACCESS",
    region: "us-east-1",
    s3Bucket: "all-events",
    secretAccessKey: "SECRET" 
});
es.put({my: "event"}, function (error) {
    if (error) console.log('put failed :/'); 
});

Event keys look like following example: 2013/09/27/00/52/40/652/508858176.json.

Documentation

S3EventStore

Public API

new S3EventStore(options)

  • options:
    • AWS: Object (Default: require('aws-sdk');) An instance of aws-sdk.
    • accessKeyId: String AWS access key ID.
    • region: String The region to send service requests to.
    • s3Bucket: String The name of S3 bucket to use for event store.
    • secretAccessKey: String AWS secret access key.
    • sslEnabled: Boolean (Default: true) Whether to enable SSL for requests.

Creates a new S3EventStore instance.

s3EventStore.put(event, [callback])

  • event: Object JavaScript object representing the event to store.
  • callback: Function (Default: undefined) An optional callback to call on success or failure.

Attempts to store the event in S3. If a callback is provided it will be called with error set to true if an error occurs or with no parameters otherwise.

s3EventStore.put({foo: 'bar'}, function (error) {
    if (error) console.log('put failed :/'); 
});

Event ~trace

  • message: String Trace message.

Emitted to trace internal execution of S3EventStore instance.

Readme

Keywords

none

Package Sidebar

Install

npm i s3-eventstore

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • tristanls