Skip to content

Instantly share code, notes, and snippets.

@apal21
Last active March 20, 2024 19:47
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apal21/80c2cfe3606d30ae7d1c655ba6100ea4 to your computer and use it in GitHub Desktop.
Save apal21/80c2cfe3606d30ae7d1c655ba6100ea4 to your computer and use it in GitHub Desktop.
AWS S3 getObject using async/await
const s3 = new AWS.S3(accessparams);
(async () => {
try {
const file = await s3
.getObject({ Bucket: 'BUCKET-NAME', Key: 'path/to/your/file' })
.promise();
console.log(file.Body);
} catch (err) {
console.log(err);
}
})();
@makaveli1313
Copy link

THANK YOU!

@pingtumiinc
Copy link

Many Thanks!

@wjosephmark
Copy link

You're a life saver! Thanks a million!

@adamreisnz
Copy link

πŸŽ‰

@niroshana1234
Copy link

Thanks a lot. Woking perfectly. πŸŽ‰πŸŽ‰πŸŽ‰πŸŽ‰

@farazahmad759
Copy link

Straight and simple

@dev-gerry-16t
Copy link

Gracias me salvaste de un callback hell

@choicedraught
Copy link

Thank you!! 😍

@Bonei
Copy link

Bonei commented Jun 16, 2022

Thank you a lot!!!!!!

@truc3651
Copy link

thanks :)))

@Zonalds
Copy link

Zonalds commented Nov 10, 2022

Thanks mate

@hsuraweera
Copy link

Does anyone know how to get the uploaded JSON file's content via lambda node v18? It works fine with SDK v2; if we use Node v18, it uses SDK v3. With SDK v3 above method is returning IncomingMessage only.

@Shah-Sachidanand
Copy link

Thanks

@vuongtran1987
Copy link

Does anyone know how to get the uploaded JSON file's content via lambda node v18? It works fine with SDK v2; if we use Node v18, it uses SDK v3. With SDK v3 above method is returning IncomingMessage only.

did you got this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment