# @pyramation/s3-streamer

> stream files to s3

Latest version **0.2.0** (published 2020-10-01) · SEE LICENSE IN LICENSE license · 0 weekly downloads

## Install

```sh
npm install @pyramation/s3-streamer
pnpm add @pyramation/s3-streamer
yarn add @pyramation/s3-streamer
bun add @pyramation/s3-streamer
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2020-10-01 |
| First published | 2020-08-28 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 17.6 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Dan Lynch |
| Maintainers | pyramation |

## Links

- npm: https://www.npmjs.com/package/@pyramation/s3-streamer
- Repository: https://github.com/pyramation/uploads
- Homepage: https://github.com/pyramation/uploads/tree/master/packages/s3-streamer#readme
- Issues: https://github.com/pyramation/uploads/issues
- npm.io page: https://npm.io/package/@pyramation/s3-streamer

## Dependencies (3)

- [aws-sdk](https://npm.io/package/aws-sdk.md) 2.729.0
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.4.2
- [@pyramation/content-type-stream](https://npm.io/package/@pyramation/content-type-stream.md) ^0.1.0

## Recent versions

- 0.2.0 (latest) — 2020-10-01
- 0.1.3 — 2020-09-30
- 0.1.1 — 2020-08-28
- 0.1.0 — 2020-08-28

## README

# s3-streamer

```sh
npm install @pyramation/s3-streamer
```

Stream uploads to s3

```js
import Streamer from '@pyramation/s3-streamer';
const streamer = new Streamer(opts)
const readStream = createReadStream(filename);
const results = await streamer.upload({
    readStream,
    filename,
    bucket,
    key
});
```

and get detailed payload results

```js
{ upload:
{ ETag: '"952fd44d14cee87882239b707231609d"',
    Location: 'http://localhost:9000/launchql/db1/assets/.gitignore',
    key: 'db1/assets/.gitignore',
    Key: 'db1/assets/.gitignore',
    Bucket: 'launchql' },
magic: { type: 'text/plain', charset: 'us-ascii' },
contentType: 'text/plain',
contents:
{ uuid: '278aee01-1404-5725-8f0e-7044c9c16397',
    sha: '7d65523f2a5afb69d76824dd1dfa62a34faa3197',
    etag: '952fd44d14cee87882239b707231609d' } }
```

## functional utils

If you don't want to use the `Streamer` class you can use the utils directly:

```js
import { getClient, upload } from '@pyramation/s3-streamer';
const client = getClient(opts)
const readStream = createReadStream(filename);
const results = await upload({
    client,
    readStream,
    filename,
    bucket,
    key
});
```

## variables

### production

```js
    const streamer = new Streamer({
      defaultBucket: BUCKET_NAME,
      AWS_REGION,
      AWS_SECRET_KEY,
      AWS_ACCESS_KEY,
      MINIO_ENDPOINT
    });
```

### using minio

```js
    const streamer = new Streamer({
      defaultBucket: BUCKET_NAME,
      AWS_REGION,
      AWS_SECRET_KEY,
      AWS_ACCESS_KEY,
      MINIO_ENDPOINT
    });
```

values:

`MINIO_ENDPOINT`=http://localhost:9000
`AWS_ACCESS_KEY`=minio-access
`AWS_SECRET_KEY`=minio-secret

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