Home

Awesome

s3-blob-store build status install size npm package version github license js semistandard style

Amazon S3 abstract-blob-store

blob-store-compatible

Installation

Install with npm

$ npm install s3-blob-store

Example

var aws = require('aws-sdk');
var s3blobs = require('s3-blob-store');

var client = new aws.S3({
  accessKeyId: process.env.S3_ACCESS_KEY,
  secretAccessKey: process.env.S3_SECRET_KEY
});

var store = s3blobs({
  client: client,
  bucket: 'mybucket'
});

// write to s3
fs.createReadStream('/tmp/somefile.txt')
  .pipe(store.createWriteStream({ key: 'somefile.txt' }));

// read from s3
store.createReadStream({ key: 'somefile.txt' })
  .pipe(fs.createWriteStream('/tmp/somefile.txt'));

// remove
store.remove({ key: 'somefile.txt' }, function (err) {
   // ...
});

// exists
store.exists({ key: 'somefile.txt' }, function (err, exists) {
  // ...
});

API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

Table of Contents

S3BlobStore

Create S3 blob store

Parameters

createReadStream

Create read stream

Parameters

Returns ReadableStream readable stream of data for the file in your bucket whose key matches

createWriteStream

Create write stream

Parameters

Returns WritableStream writable stream that you can pipe data to

remove

Remove object from store

Parameters

exists

Check if object exits

Parameters

WriteParams

S3 putObject params

Options

Type: Object

Properties

ReadStreamOptions

Options including s3-stream-download configuration

S3

S3 client

ReadParams

S3 getObject params