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

aws-s3-tools

v0.4.0

Published

A NodeJS module to make it easier to deal with S3 objects

Readme

npm GitHub repo size GitHub

AWS S3 Tools is a package to make it easier to deal with S3 objects, available on NPM, where you can:

  • Create/Delete a S3 bucket
  • Check if a S3 bucket exists
  • List S3 bucket content
  • Check if a S3 object exists
  • Download S3 objects to local files
  • Delete S3 objects
  • Upload local files to S3 bucket

Table of Contents

Disclaimer

This project was created based on another developed in Python. If you would like to use these methods in Python, visit this repo.

Installation

The package is available through NPM, which means you can choose to install it using either npm or yarn

NPM:

npm install aws-s3-tools

Yarn:

yarn add aws-s3-tools

Documentation

Check

  • Check if an object exists in a S3 bucket
const exists: boolean = await objectExists("BucketName", "FileName");
  • Check if an S3 bucket exists
const exists: boolean = await bucketExists("BucketName");

Create

  • Create a S3 bucket
await createBucket({Bucket: "BucketName"});

Delete

  • Delete an object in a S3 bucket
await deleteObject("BucketName", "existingFile.pdf");
  • Delete all objects under a prefix
await deleteFromPrefix("BucketName", "folder");
  • Delete all objects in the keys list from S3 bucket
const keys = ["folder/test.pdf", "folder/file.csv"];
await deleteFromKeys("BucketName", keys);
  • Delete a S3 bucket
await deleteBucket("BucketName");

Download

  • Retrieve one object from AWS S3 bucket and store into local disk
await downloadObject("BucketName","existingFile.pdf", "downloadedFile.pdf");

List

  • List all objects in a S3 bucket (with filter options)
const keysList: string[] = await listObjects("BucketName", "FolderName");

Move

  • Move S3 object from source bucket to destination bucket
await moveObject("SourceBucketName", "SourceFileKey", "DestinationBucketName", "DestinationFileKey");
  • Move a list of S3 objects from source bucket to destination
await moveObjects("SourceBucketName", ["SourceFileKey"], "DestinationBucketName", ["DestinationFileKey"]);

Upload

  • Upload one file from local disk and store into AWS S3 bucket
await uploadObject("BucketName","s3file.pdf", "localFile.pdf");
  • Upload list of files to specific objects
await uploadObjects("BucketName",[{ key: "s3file.pdf", localFilename: "localFile.pdf" }]);
  • Upload all files for a given folder (just root files) and store them into a S3 bucket under a prefix (with filter options)
await uploadFolderToPrefix("BucketName", "s3Folder", "localFolder");

The documentation for each method supported by this module can be found here.

Authentication

To use this package, it's necessary to authenticate to AWS, using one of three options:

  • Load credentials from a json file
AWS.config.loadFromPath("./config.json");
// call methods

For more information, visit Authenticate with json file.

  • Load credentials from Shared Credentials file
AWS.config.credentials = new AWS.SharedIniFileCredentials({profile: 'work-account'});
// call methods

For more information, visit Authenticate with Shared Credentials file.

  • Load ClientId, ClientSecret and Region directly
AWS.config.update({
 accessKeyId: CLIENT_ID,
 secretAccessKey: CLIENT_SECRET,
 region: REGION
});
// call methods

For more information, visit Authenticate with Environment Variables.

Tests

To run the tests for this project:

NPM:

npm run test

Yarn:

yarn test

Problems or issues?

If you encounter any problems, bugs or other issues with the package, please create an issue in the GitHub repo.

License

MIT