1.4.0 • Published 12 months ago

@masterfix/s3-streams v1.4.0

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
12 months ago

s3-streams

A node library which simplifies uploads and downloads of S3 objects.

Installation

npm install @masterfix/s3-streams

Example

import {S3Client} from '@aws-sdk/client-s3';
import {createS3ReadStream} from '@masterfix/s3-streams';
import {createWriteStream} from 'fs';

const s3Client = new S3Client({
  region: 'US',
  endpoint: 'https://eu-central-1.linodeobjects.com',
  credentials: {
    accessKeyId: 'topsecret',
    secretAccessKey: 'topsecret',
  },
});

const readStream = createS3ReadStream({
  s3Client,
  bucket: 'mybucket',
  key: 'remote-file.tar.gz',
});

const writeStream = createWriteStream('local-file.tar.gz');

readStream.pipe(writeStream);

Running Tests

To run tests, run the following command:

npm test

Environment Variables

To run the tests, you will need to add the following environment variables to your .env file:

S3_REGION S3_ENDPOINT S3_ACCESS_KEY S3_SECRET_KEY S3_BUCKET

License

MIT

1.4.0

12 months ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago