JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 41863
  • Score
    100M100P100Q146661F
  • License MIT

Package Exports

  • s3-stream-upload

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (s3-stream-upload) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

s3-stream-upload

A writable stream which uploads to Amazon S3 using the multipart file upload API.

Inspired by s3-upload-stream.

Install

npm install s3-stream-upload

Usage

var S3StreamUpload = require("s3-stream-upload");

var uploader = S3StreamUploader({
  accessKeyId: process.env.S3_ACCESS_KEY_ID,
  secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
  Bucket: process.env.S3_BUCKET_NAME
});

var key = "file.mp3";

fs.readFileStream(__dirname + "/file.mp3")
  .pipe(uploader({ Key: key }))
  .on("error", function (err) {
    console.error(err);
  })
  .on("finish", function () {
    console.log("File uploaded!");
  });

API

  • S3StreamUploader(s3Config) Takes configuration (same options as aws-sdk's S3 constructor) and returns a new stream uploader function that creates streams.
  • uploader(config) Creates and returns a WritableStream for uploading to S3. Takes a config object, which takes the same options as S3.createMultipartUpload, and will use the Bucket property of the creation if not specified in config. Additional, non-S3 config options may be set, listed below: ** concurrent: How many chunks can be sent to S3 concurrently.

Testing

Right now, a brutal integration test by uploading files. Need to add unit tests and mocks.

npm test

License

MIT License, Copyright (c) 2014 Jordan Santell