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

s3_file_append

v1.0.6

Published

Stream Json files to S3 with local buffer

Downloads

7

Readme

node_s3_file_buffer

About: This is a simplified self contained version of Streaming data, Json in this case to S3. Example of a full blown implementation with Kinesis, Lambda and S3 to stream data to S3, as described here: https://aws.amazon.com/blogs/big-data/persist-streaming-data-to-amazon-s3-using-amazon-kinesis-firehose-and-aws-lambda/

API to locally buffer and upload JSON streams to S3 files S3 Uploader is provided but other implementations can be created Upload is based on size limit and time limit Multiple streams can be created with domain and namespace hierarchy

to run with S3 uploader AWS credentials must be setup to be used by the AWS SDK: check this for setting up the credentials: https://docs.aws.amazon.com/amazonswf/latest/awsrbflowguide/set-up-creds.html set S3_UPLOADER_BUCKET env var name to specify which bucket files are written to.

the JsonBufferStreamer class requires the following parameters to instantiate: uploader - a class that implements the - async upload({file_name, domain, namespace}) signature filesPath - location for the buffered filed, a directory onUpload - optional - callbeack for file upload notifications schedulerIntervalSec - if time based flush is required, this is used to indicate the time interval for the scheduler to implement the buffers flushing (based on the specific stream definitions). use 0 to prevent scheduled flush

API: open(domain, namespace, sizeLimit = 100000, timeLimit = 60) - opens a new stream with domain name, a namespace, the size limit that once passed will trigger a file upload the the timeLimit after which, if any data is in the stream it will be uploaded

append(domain, namespace, json) - Appends a Json to an existing stream, the file created will have an array of Jsons.

close(domain, namespace) - finalizes a Json stream, triggers a final flush of the stream to be uploaded.

flush() - used to flush all the buffers by uploading them using the uploader

shutDown() - used to initiate service shutdown, all files will be flushed and uploaded, all incoming append requests will be refused.

NOTE - AWS failures may occur silently, typically due to misconfiguration of AWS credentials