Skip to content

A simple, small library to abstract the mechanism to fetch all the objects in a bucket (No pagination handling required) with prefix support.

License

Notifications You must be signed in to change notification settings

mim-Armand/s3-list-all-objects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

s3-list-all-the-objects

A simple, small library to abstract the mechanism to fetch all the objects in a bucket (No pagination handling required) with prefix support.

This is just a simple abstraction that removes the need to watch for paginated results and returns a list of all the objects in the bucket.. you can also include the flag (defaults to true) to receive only an array of object keys ( strings ) and not an array of objects.

Example usage:

const aws = require('aws-sdk');
const s3 = new aws.S3();
const { listAllObjects } = require('s3-list-all-the-objects');

const test = async () => {
  const myObjects = await listAllObjects('my_bucket_name', 'optional_prefix'); // if you want to get the whole object rather than just the ky, pass `false` as the 3rd parameter
  console.log('Array of object keys ==> ', myObjects);
}

test();

About

A simple, small library to abstract the mechanism to fetch all the objects in a bucket (No pagination handling required) with prefix support.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published