Class: Canoe

Canoe

new Canoe(s3)

Helper functionality for working with S3.
Parameters:
Name Type Description
s3 Object Authenticated instance of AWS.S3
Source:
Example
  var AWS = require('aws-sdk')
  var s3 = new AWS.S3(configParams)
  var canoe = new Canoe(s3)

Methods

createPrefixedReadStream(params, callback)

Stream objects by prefix.
Parameters:
Name Type Description
params Object Parameters to list objects
Properties
Name Type Description
Bucket String The S3 bucket to download from
Prefix String The S3 prefix to download from
callback function Called with error, stream
Source:
Example
  var canoe = new Canoe(s3)
  var params = {Bucket: 'stuff', Key: 'path/to/things/'}
  canoe.createPrefixedReadStream(params, function (err, readable) {
    readable.pipe(process.stdout)
  })

createWriteStream(params, callback) → {Stream}

Create a writable stream to upload an object to S3.
Parameters:
Name Type Argument Description
params Object Params to create an instance of S3Stream
callback function <optional>
Called when the stream is ready.
Source:
Returns:
Writable stream
Type
Stream
Example
  var canoe = new Canoe(s3)
  var s3stream = canoe.createWriteStream({
    Bucket: 'random-access-memories',
    Key: 'to-get-lucky.log'
  })
  fs.createReadStream('./for-good-fun.log').pipe(s3stream)