s3-stream-upload

WebJar for s3-stream-upload

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

s3-stream-upload
Last Version

Last Version

2.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

s3-stream-upload
WebJar for s3-stream-upload
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/jsantell/s3-stream-upload

Download s3-stream-upload

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/s3-stream-upload/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>s3-stream-upload</artifactId>
    <version>2.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/s3-stream-upload/
implementation 'org.webjars.npm:s3-stream-upload:2.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/s3-stream-upload/
implementation ("org.webjars.npm:s3-stream-upload:2.0.2")
'org.webjars.npm:s3-stream-upload:jar:2.0.2'
<dependency org="org.webjars.npm" name="s3-stream-upload" rev="2.0.2">
  <artifact name="s3-stream-upload" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='s3-stream-upload', version='2.0.2')
)
libraryDependencies += "org.webjars.npm" % "s3-stream-upload" % "2.0.2"
[org.webjars.npm/s3-stream-upload "2.0.2"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : buffer-queue jar [1.0.0,1.1)
org.webjars.npm : readable-stream jar [2.3.0,3)

Project Modules

There are no modules declared in this project.

s3-stream-upload

Build Status Build Status

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

// index.js
var UploadStream = require("s3-stream-upload");
var S3 = require("aws-sdk").S3;
var fs = require("fs");

var key = "file.mp3";
var s3 = new S3();

fs.createReadStream(__dirname + "/file.mp3")
  .pipe(UploadStream(s3, { Bucket: "my-bucket", Key: key }))
  .on("error", function (err) {
    console.error(err);
  })
  .on("finish", function () {
    console.log("File uploaded!");
  });
$ AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar node index.js

See aws-sdk-js for other ways to configure you environment variables.

API

UploadStream(s3, s3Config, config)

Creates and returns a WritableStream for uploading to S3. Takes an S3 instance, and a s3Config object, which takes the same options as S3.createMultipartUpload. Additional, non-S3 config options may be set on config, listed below:

  • concurrent How many chunks can be sent to S3 concurrently. 1 by default.

Events

  • chunk-uploaded - Emitted when a MPU chunk has been uploaded to S3, with the number of chunks uploaded at this point.
  • All WritableStream events.

Properties

Testing

To run unit tests, run:

npm test

License

MIT License, Copyright (c) 2014 Jordan Santell

Versions

Version
2.0.2