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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@losttracker/s3-uploader

v1.0.4

Published

Package to upload compressed files to AWS S3

Readme

s3-uploader

Description

A node.js module to upload files to your S3 bucket. It also allows upload of files compressed using Pako after decompressing

Install

npm install @losttracker/s3-uploader

Example

const s3Uploader = require('@losttracker/s3-uploader');

const awsCredentials = {
  "region" : "us-west-2",
  "accessKeyId" : "access_key_id",
  "secretAccessKey" : "secret_access_key",
};
const bucket = 'fileuploads_bucket';

// to change file name or edit path. See uploadUrlGen below to know the list of
// parameters passed to method
const uploadUrlGen = (params) => {
  return 'trial_up/' + params.fields.formDataParam + params.filename;
};

const uploadDetails = await s3Uploader({request: req, bucket, awsCredentials, uploadUrlGen});

API

The module returns a promise. The result is an array of responses from S3 upon successful file uploads.

S3-uploader method

The method accepts an object with the following keys: | Name | Type | Parameters/Properties | Description | |-----------|---------|-----------------------------|-------------| | Request | Object | - | The incoming request object| |s3_instance* | | - | You can create an s3 instance using the aws-sdk and pass it as a parameter | |awsCredential* | Object | region, accessKeyId, secretAccessKey | The object must contain valid credentials required to connect to S3 instance | | bucket | string | - | Valid S3 Bucket to upload the file to | | mimeFilter | Method | (mimetype, file_extension) Return:bool | A method that will be passed mime and file extension. Can be used to filter files and stop upload progress. Return < True > when file is supported. | | compressed | boolean | - | If using pako to compress. Default: false. | | compressionRatio | number (1-9) | - | If using Pako, compression ratio to be used. Default: 1. | | uploadUrlGen | Method | ({fields**, mimetype, bucket, filename}) <Returns: string> | This method can be used to programatically calculate the key to upload files to in your S3 bucket | | maxSize | number | - | The maximum file size that can be uploaded. Default: null (unlimited) | | s3UploadParams | Object | - | Any additional settings to be passed to the s3.upload method while uploading. Example: Metadata. For more information see: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#upload-property | | busboyParams | Object | - | Any additional settings to be passed to the busboy constructor. Example: HWM. For more information see: https://www.npmjs.com/package/busboy#busboy-methods |

* Any one of these 2 parameters is necessary

**it contains the parameters appended to formdata as an object

Please contact me on [email protected] for any suggestions!