Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const AWS = require('aws-sdk');
const S3 = new AWS.S3({'region':'ap-northeast-1'});
exports.handler = async (event) => {
let params = {
'Bucket': 'バケット名',
'Key': 'hoge/sample.json'
}
const data = await existFile(params)
}
async function existFile(params){
let bool = true
await S3.getObject(params).promise().catch(e=>{
bool = false
})
return bool
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment