# s3-upload-by-readstream

> This is easy to use readStream upload your file to your AWS S3

Latest version **1.0.1** (published 2018-04-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install s3-upload-by-readstream
pnpm add s3-upload-by-readstream
yarn add s3-upload-by-readstream
bun add s3-upload-by-readstream
```

## 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 | 1.0.1 |
| Published | 2018-04-14 |
| First published | 2018-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ryo |
| Maintainers | ryo0126 |
| Keywords | S3, AWS S3 |

## Links

- npm: https://www.npmjs.com/package/s3-upload-by-readstream
- Repository: https://github.com/zack7498/S3_stream_upload-nodejs
- Homepage: https://github.com/zack7498/S3_stream_upload-nodejs#readme
- Issues: https://github.com/zack7498/S3_stream_upload-nodejs/issues
- npm.io page: https://npm.io/package/s3-upload-by-readstream

## Dependencies (1)

- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.7.21

## 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

- 1.0.1 (latest) — 2018-04-14
- 1.0.0 — 2018-04-14

## README

## Description

This module can easy to use **readStream** upload file to Your AWS S3.

This module use the AWS official SDK.


## Installation

`npm install s3-upload-by-readstream`

## Usage

``` js

const S3 = require('s3-upload-by-readstream');

let s3client = new S3(
        `Your_BucketName`,
        `Your region`,
        `Your AWS access key ID`,
        `Your AWS secret access key`,
        S3OptionObject
    );
```

## Upload Your File or any Data by ReadStream

use `s3client.uploadFile`

### *description*

Will upload your file by ReadStream.

### *parameter:*
* upload_path **{string}** : The file will upload to this path.
* filename **{string}** : Just filename.
* mimeType **{string}** : MIME type. ex：application/json
* data **{readStream or any}** : Your need to upload Data.
* ACL **{string}** : was same as AWS S3 ACL.
* callback **{function}** : when upload finish will call and return **three parameter** :
    * *RSerror* : was same as ReadStream Error. [see nodejs document](https://nodejs.org/dist/latest-v8.x/docs/api/stream.html#stream_class_stream_readable)
    * *S3error* **{Error}**: was same as API AWS_S3.uploadFile error Msg. [see AWS S3 Official Doc](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#upload-property).
    * *data* **{Object}**: was same as api AWS_S3.uploadFile Data. [see AWS S3 Official Doc](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#upload-property).

``` js
//Example 1: use other ReadStream upload

const fs = require('fs');
const fsRS = fs.createReadStream(`yourfile.json`));

s3client.uploadFile(
    `Your_Bucket_TargetPath`,
    `myJson.json`,
    `application/json`,
    fsRS,
    `public-read`,
    (rsErr, S3err, data)=>{
    //other code...
});

//Example 2: will Auto use ReadStrem upload

s3client.uploadFile(
    `Your_Bucket_TargetPath`,
    `myJson.json`,
    `application/json`,
    JSON.stringify({"example": "example"}),
    `public-read`,
    (rsErr, S3err, data)=>{
    //other code...
});

```

## License

MIT

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