Created
February 12, 2023 23:02
-
-
Save subudear/b8ef63aeed6717f735dbeb1a42384ffb to your computer and use it in GitHub Desktop.
s3fileread
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 AWS = require('aws-sdk'); | |
const s3 = new AWS.S3(); | |
exports.handler = async function(params){ | |
console.info('fetching file from s3 bucket'); | |
try { | |
const fileData = await s3.getObject(params).promise(); | |
console.log(JSON.parse(fileData.Body)) | |
return fileData; | |
} catch (err) { | |
console.error(err); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment