Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
95
rated 0 times [  99] [ 4]  / answers: 1 / hits: 99115  / 9 Years ago, tue, june 9, 2015, 12:00:00

I am using aws-sdk using node.js. I want to list images in specified folder e.g.This



I want to list all files and folder in this location but not folder (images) content. There is list Object function in aws-sdk but it is listing all the nested files also.



Here is the code :



var AWS = require('aws-sdk');
AWS.config.update({accessKeyId: 'mykey', secretAccessKey: 'mysecret', region: 'myregion'});
var s3 = new AWS.S3();

var params = {
Bucket: 'mystore.in',
Delimiter: '',
Prefix: 's/5469b2f5b4292d22522e84e0/ms.files'
}

s3.listObjects(params, function (err, data) {
if(err)throw err;
console.log(data);
});

More From » node.js

 Answers
47

It's working fine now using this code :



var AWS = require('aws-sdk');
AWS.config.update({accessKeyId: 'mykey', secretAccessKey: 'mysecret', region: 'myregion'});
var s3 = new AWS.S3();

var params = {
Bucket: 'mystore.in',
Delimiter: '/',
Prefix: 's/5469b2f5b4292d22522e84e0/ms.files/'
}

s3.listObjects(params, function (err, data) {
if(err)throw err;
console.log(data);
});

[#66276] Saturday, June 6, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaredsages

Total Points: 273
Total Questions: 97
Total Answers: 105

Location: French Southern and Antarctic Lands
Member since Fri, Jan 6, 2023
1 Year ago
;