Skip to content

Reads a file from S3 via stream using AWS SDK and prints its content to stdout, or to another writable stream. CLI ready + support to gzip. Useful to quickly inspect large files without the need to download it entirely.

Notifications You must be signed in to change notification settings

DiegoZoracKy/s3-read-file-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

s3-read-file-stream

npm npm

Reads a file from S3 via stream using AWS SDK and prints its content to stdout, or to another writable stream. CLI ready + support to gzip. Useful to quickly inspect large files without the need to download it entirely.

Goals

  • Support to gzip
  • CLI ready

Usage

Using it as a module or via CLI, gzip is supported for the s3Path. The .gz extension is all that is needed to determine when the input must be decompressed and if the output should be compressed. If there is no .gz extension it will be handled as a text file (UTF-8).

S3 protocol is accepted as well (e.g. s3://bucket-name/path/to/file.gz).

CLI

via NPX

$ npx s3-read-file-stream --s3Path="https://s3.amazonaws.com/bucket-name/path/to/file.gz"

As a global module

install:

$ npm install -g s3-read-file-stream

and use it:

$ s3-read-file-stream --s3Path="https://s3.amazonaws.com/bucket-name/path/to/file.gz"

Node.js module

install:

$ npm install s3-read-file-stream
const s3ReadFileStream = require('../');

s3ReadFileStream("https://s3.amazonaws.com/bucket-name/path/to/file.gz");

Another writable stream can be set as a destination, to be used instead of stdout:

const s3ReadFileStream = require('../');
const fs = require('fs');

s3ReadFileStream("https://s3.amazonaws.com/bucket-name/path/to/file.gz", fs.createWriteStream('./file.txt'));

About

Reads a file from S3 via stream using AWS SDK and prints its content to stdout, or to another writable stream. CLI ready + support to gzip. Useful to quickly inspect large files without the need to download it entirely.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published