Last active
March 20, 2024 19:47
-
-
Save apal21/80c2cfe3606d30ae7d1c655ba6100ea4 to your computer and use it in GitHub Desktop.
AWS S3 getObject using async/await
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
did you got this?