npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

s3st

v1.1.0

Published

A command line utility that allows you to stream data from multiple S3 objects directly into your terminal

Downloads

9

Readme

s3st

A command line utility that allows you to stream data from multiple S3 objects directly into your terminal.

npm version CircleCI JavaScript Style Guide

Demo!

Demo image terminal

See the FULL demo on asciinema

Rationale

This utility is particularly useful when you are storing data in S3 and you want to easily process the content of your S3 objects from your command line, for instance if you are storing your CloudTrail logs in an S3 buckets and you want to grep over them you can do something like this:

s3st mybucket AWSLogs/123456789/CloudTrail/eu-west-1/2019/01/17/ | jq . | grep "lambda"

By default the command line will be able to decompress most compressed files in realtime (gzip, brotli and deflate).

Install

There are several ways to install s3st:

Install global with NPM

(Requires Node v10+):

npm i -g s3st

Precompiled binaries

Alternatively you can download one of the pre-compiled binaries for linux, windows, mac or alpine from the Releases page.

These binaries do not require you to have Node installed.

With npx (use without install)

npx s3st some-s3-bucket

Usage

Usage: s3st [options] <bucket> [prefix]

Options:
  -v, --version            output the version number
  -D, --do-not-decompress  Do not try to decompress files automatically (gzip, deflate, brotli)
  -h, --help               output usage information

bucket represents the name of the bucket to iterate over prefix is an optional argument that you can pass to select a subset of object that match the given prefix.

Automatic Decompression

The command will automatically try to decompress compressed files based on their extension, as per the following mapping:

  • .gz or .gzip: decompress using gzip
  • .zz or .deflate: decompress using deflate
  • .br or .brotli: decompress using brotli (available only if using Node v11.7+)

If you want to disable this option you can specify the flag --do-not-decompress

AWS Authentication

The tool will assume you have the proper environment variables or configuration files properly set as per the AWS CLI documentation in order to authenticate requests to AWS.

Programmatic usage

This package can also be used programmatically as per the following example:

'use strict'

const createS3stStream = require('s3st')
const AWS = require('aws-sdk')

// creates an s3 client using the AWS SDK
const s3 = new AWS.S3()

const stream = createS3stStream(s3, 'mybucket', 'some-prefix')

stream.pipe(process.stdout) // attach the stream to standard output

createS3stStream exposes accepts the following arguments:

  • s3: an s3 client instance from the AWS SDK or a compatible implementation
  • bucketName: the name of the bucket
  • prefix (optional): an object prefix to filter objects in the bucket
  • transform (optional): a function that allows you to transform the content of objects as they get streamed (useful for instance for decompression or decryption).

Transform function

If you want to provide a custom transform function, it should respect the following signature.

Arguments

  • key (string): the name of the current object (object key)

Return value

  • a Transform stream that manipulates the object

If you want to use the default decompression implementation available by the default in the command line client, you can import that from s3st/src/transformers/decompress.

Data Transfer costs

If you are using this tool to stream large amount of data be aware that this might have an impact on your data transfer costs. In such cases, using an alternative approach like S3 Select, could be a way to save on cost.

Make sure you are aware of alternatives and that you make careful costs considerations before running any heavy workload in the cloud.

Contributing

Everyone is very welcome to contribute to this project. You can contribute just by submitting bugs or suggesting improvements by opening an issue on GitHub.

You can also submit PRs as long as you adhere with the code standards and write tests for the proposed changes.

License

Licensed under MIT License. © Luciano Mammino.