# s3-streaming-upload

> Streaming upload to S3

Latest version **0.3.4** (published 2021-01-21) · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.4 |
| Published | 2021-01-21 |
| First published | 2013-06-06 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 12.13.0 |
| Dependencies | 2 |
| Unpacked size | 16.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 123 |
| Author | Apiary Inc |
| Maintainers | abtris, kubakubula, apiary-sre |
| Keywords | aws, s3, stream, aws stream, aws s3 stream, aws s3, aws s3 streaming, aws s3 streaming upload, aws-sdk s3 streaming upload, aws s3 upload, s3 upload, s3 stream upload, s3 streaming, streaming upload, s3 streaming upload |

## Links

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

## Dependencies (2)

- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.814.0
- [readable-stream](https://npm.io/package/readable-stream.md) ^3.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

- 0.3.4 (latest) — 2021-01-21
- 0.3.3 — 2020-12-31
- 0.3.2 — 2020-11-18
- 0.3.1 — 2019-05-30
- 0.3.0 — 2019-05-06
- 0.2.3 — 2017-03-20
- 0.2.2 — 2016-08-22
- 0.2.1 — 2015-03-11
- 0.2.0 — 2015-02-19
- 0.1.17 — 2015-01-22
- 0.1.16 — 2014-11-18
- 0.1.15 — 2014-10-02
- 0.1.14 — 2014-06-13
- 0.1.13 — 2014-04-08
- 0.1.11 — 2014-03-31
- … 10 more at https://npm.io/package/s3-streaming-upload/versions

## README

## s3-streaming-upload [![s3-streaming-upload](https://github.com/apiaryio/s3-streaming-upload/workflows/s3-streaming-upload%20CI/badge.svg)](https://github.com/apiaryio/s3-streaming-upload/actions?query=workflow%3A%22s3-streaming-upload+CI%22)

[s3-streaming-upload](https://github.com/apiaryio/s3-streaming-upload) is [node.js](http://nodejs.org) library that listens to your [stream](http://nodejs.org/docs/v0.8.9/api/stream.html) and upload its data to Amazon S3 and OCI Bucket Store.

It is heavily inspired by [knox-mpu](https://github.com/nathanoehlman/knox-mpu), but unlike it, it does not buffer data to disk and is build on top of [official AWS SDK](https://github.com/aws/aws-sdk-js) instead of knox.

### Changes

- Version 0.3.2 NodeJS 12+ supported.
- Version 0.3.x Change from Coffee-script to Javascript. NodeJS 6 and 8 supported.

- Version 0.2.x using [ManagedUpload API](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3/ManagedUpload.html). NodeJS 0.10 and 0.12 supported.

- Version 0.1.x using [MultiPartUpload API](http://docs.amazonwebservices.com/AmazonS3/latest/dev/sdksupportformpu.html). NodeJS 0.8 and 0.10 supported.

### Installation

Installation is done via NPM, by running `npm install s3-streaming-upload`

### Features

- Super easy to use
- No need to know data size beforehand
- Stream is buffered up to specified size (default 5MBs) and then uploaded to S3
- Segments are not written to disk and memory is freed as soon as possible after upload
- Uploading is asynchronous
- You can react to upload status through events

### Quick example

```javascript
var Uploader = require('s3-streaming-upload').Uploader,
  upload = null,
  stream = require('fs').createReadStream('/etc/resolv.conf');

upload = new Uploader({
  // credentials to access AWS
  accessKey: process.env.AWS_S3_ACCESS_KEY,
  secretKey: process.env.AWS_S3_SECRET_KEY,
  bucket: process.env.AWS_S3_TEST_BUCKET,
  objectName: 'myUploadedFile',
  stream: stream,
  debug: true,
});

upload.send(function(err) {
  if (err) {
    console.error('Upload error' + err);
  }
});
```

### Setting up ACL

Pass it in `objectParams` to the `Uploader`:

```javascript
upload = new Uploader({
  // credentials to access AWS
  accessKey: process.env.AWS_API_KEY,
  secretKey: process.env.AWS_SECRET,
  bucket: process.env.AWS_S3_TRAFFIC_BACKUP_BUCKET,
  objectName: 'myUploadedFile',
  stream: stream,
  objectParams: {
    ACL: 'public-read',
  },
});
```

### Example usage with Oracle Cloud (OCI) compatible S3 API

```javascript
region = process.env.OCI_REGION;
tenancy = process.env.OCI_TENANCY;
// define custom service
service = new aws.S3({
  apiVersion: '2006-03-01',
  credentials: {
    accessKeyId: process.env.BUCKET_ACCESS_KEY,
    secretAccessKey: process.env.BUCKET_SECRET_KEY,
  },
  params: { Bucket: process.env.BUCKET_NAME },
  endpoint: `${tenancy}.compat.objectstorage.${region}.oraclecloud.com`,
  region: region,
  signatureVersion: 'v4',
  s3ForcePathStyle: true,
});

uploader = new Uploader({
  accessKey: process.env.BUCKET_ACCESS_KEY,
  secretKey: process.env.BUCKET_SECRET_KEY,
  bucket: process.env.BUCKET_NAME,
  objectName: filename,
  stream: source,
  service: service,
  objectParams: {
    ContentType: 'text/csv',
  },
  debug: true,
});
```

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