Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

rxtoolkit/s3

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@rxtk/s3

🪣 RXJS operators for working with AWS S3

npm i @rxtk/s3
yarn add @rxtk/s3

API

fromS3File

Downloads a file to AWS S3 (as a stream).

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).

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);

About

🪣 RXJS operators for working with AWS S3

Topics

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.