Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rxtoolkit/s3
🪣 RXJS operators for working with AWS S3
https://github.com/rxtoolkit/s3
aws data-science fp functional-programming observables package reactive-programming rxjs s3 s3-storage
Last synced: 6 days ago
JSON representation
🪣 RXJS operators for working with AWS S3
- Host: GitHub
- URL: https://github.com/rxtoolkit/s3
- Owner: rxtoolkit
- License: mit
- Created: 2021-03-18T01:32:58.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-16T18:39:22.000Z (11 months ago)
- Last Synced: 2024-12-10T14:39:57.548Z (about 1 month ago)
- Topics: aws, data-science, fp, functional-programming, observables, package, reactive-programming, rxjs, s3, s3-storage
- Language: JavaScript
- Homepage:
- Size: 476 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @rxtk/s3
> 🪣 RXJS operators for working with AWS S3```bash
npm i @rxtk/s3
``````bash
yarn add @rxtk/s3
```## API
### `fromS3File`
Downloads a file to AWS S3 (as a stream).
```js
import AWS from 'aws-sdk';
import {concat} from 'rxjs';
import {fromS3file} from '@rxtk/s3';// Download AWS S3 file as a stream of file chunks (Buffers)
const downloadParams = {
s3Bucket: 'my-fabulous-bucket',
s3Key: 'path/to/file/hello-world.json',
byteLength: 32000, // (Optional) Size of the download chunks. Defaults to 32000.
s3Client: new AWS.S3(), // (Optional) The s3 client to use
rawResponse: false, // (Optional) - expose raw S3 JSON responses. Defaults to false.
};
const bufferChunk$ = fromS3File(downloadParams);
bufferchunk$.subscribe(console.log);
```### `toS3File`
Uploads a file to AWS S3 (as a stream).
```js
import {concat} from 'rxjs';
import {toS3File} from '@rxtk/s3';// create a stream of file chunks
const chunk0 = Buffer.from('{"hello":');
const chunk1 = Buffer.from('"world"}');
const chunk$ = concat(chunk0, chunk1);// upload the chunks to an AWS S3 file
const uploadParams = {
s3Bucket: 'my-fabulous-bucket',
s3Key: 'path/to/file/hello-world.json',
contentType: 'application/json',
};
const upload$ = chunk$.pipe(toS3File(uploadParams));
upload$.subscribe(console.log);
```