# s3-stream-upload

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

Latest version **2.0.2** (published 2017-06-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install s3-stream-upload
pnpm add s3-stream-upload
yarn add s3-stream-upload
bun add s3-stream-upload
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2017-06-20 |
| First published | 2014-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 27 |
| Author | Jordan Santell |
| Maintainers | chriskinsman, jsantell |
| Keywords | stream, upload, aws, s3, amazon |

## Links

- npm: https://www.npmjs.com/package/s3-stream-upload
- Repository: https://github.com/jsantell/s3-stream-upload
- Homepage: https://github.com/jsantell/s3-stream-upload#readme
- Issues: https://github.com/jsantell/s3-stream-upload/issues
- npm.io page: https://npm.io/package/s3-stream-upload

## Dependencies (2)

- [buffer-queue](https://npm.io/package/buffer-queue.md) ~1.0.0
- [readable-stream](https://npm.io/package/readable-stream.md) ^2.3.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 2.0.2 (latest) — 2017-06-20
- 2.0.1 — 2017-04-05
- 2.0.0 — 2015-03-16
- 1.1.2 — 2015-03-13
- 1.1.1 — 2015-03-12
- 1.1.0 — 2015-03-12
- 1.0.0 — 2014-10-16
- 0.0.6 — 2014-06-23
- 0.0.5 — 2014-06-21
- 0.0.4 — 2014-06-20
- 0.0.3 — 2014-06-20
- 0.0.2 — 2014-06-20
- 0.0.1 — 2014-04-29

## README

# s3-stream-upload

[![Build Status](http://img.shields.io/travis/jsantell/s3-stream-upload.svg?style=flat-square)](https://travis-ci.org/jsantell/s3-stream-upload)
[![Build Status](http://img.shields.io/npm/v/s3-stream-upload.svg?style=flat-square)](https://www.npmjs.org/package/s3-stream-upload)

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

Inspired by [s3-upload-stream](https://github.com/nathanpeck/s3-upload-stream).

## Install

```
npm install s3-stream-upload
```

## Usage

```javascript
var UploadStream = require("s3-stream-upload");
var S3 = require("aws-sdk").S3;

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

fs.readFileStream(__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!");
  });
```

## API

### `UploadStream(s3, s3Config, config)`


Creates and returns a [WritableStream](http://nodejs.org/api/stream.html#stream_class_stream_writable) for uploading to S3. Takes an S3 instance, and a `s3Config` object, which takes the same options as [S3.createMultipartUpload](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/frames.html). 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](http://nodejs.org/api/stream.html#stream_class_stream_writable) events.

#### Properties

* `bytesWritten` - Like [fs.WriteStream](http://nodejs.org/api/fs.html#fs_class_fs_writestream), bytes uploaded to S3 currently.


## Testing

To run unit tests, run:

```
npm test
```


## License

MIT License, Copyright (c) 2014 Jordan Santell

---
_Source: https://npm.io/package/s3-stream-upload · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
