Menu

GET list of objects located under a specific S3 folder

September 6, 2019 - Javascript
var params = {
Bucket:Bucket_Name,
Delimiter: '/',
Prefix: 'foldername/'
};

s3Bucket.listObjects(params, function(err, data) {
            if (err) {
                return 'There was an error viewing your album: ' + err.message
            }else{
                console.log(data.Contents,"<<<all content");

                data.Contents.forEach(function(obj,index){
                    console.log(obj.Key,"<<<file path")
                })
            }
        })

source https://stackoverflow.com/questions/50366708/get-list-of-objects-located-under-a-specific-s3-folder

Leave a Reply