Skip to content

Instantly share code, notes, and snippets.

@subudear
Created February 12, 2023 23:02
Show Gist options
  • Save subudear/b8ef63aeed6717f735dbeb1a42384ffb to your computer and use it in GitHub Desktop.
Save subudear/b8ef63aeed6717f735dbeb1a42384ffb to your computer and use it in GitHub Desktop.
s3fileread
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