Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maskaravivek/30a645878b61fb89ebb09edd49427d72 to your computer and use it in GitHub Desktop.
Save maskaravivek/30a645878b61fb89ebb09edd49427d72 to your computer and use it in GitHub Desktop.
const s3 = require('./config');
const bucketName = 'my-unique-bucket-name';
const params = {
Bucket: bucketName
};
s3.listObjects(params, (error, data) => {
if (error) {
console.error(error);
} else {
console.log('Files in the bucket:');
data.Contents.forEach((file) => {
console.log(file.Key);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment