Answers for "list all files in s3 bucket"

1

list all files in s3 bucket

// Array of all keys in s3 bucket
const findKeys = async(bucketName)=>{
    const {Contents} =  await s3.listObjects({Bucket: bucketName}).promise()
    const keysArr = []
    for(const obj of Contents){
        keysArr.push(obj.Key)
    }
    return keysArr
}
Posted by: Guest on January-18-2022

Code answers related to "list all files in s3 bucket"

Browse Popular Code Answers by Language