How to list files in amazon s3 bucket with in the folder using knox and nodejs

161 Views Asked by At

I want to list file in my s3 bucket with in the folder, my bucket structure is

         /> folder_1
a_bucket -> folder_2
         \> folder_3

I want list files in folder_1 only

1

There are 1 best solutions below

0
byteC0de On BEST ANSWER

My problem got solved

s3client.list({ "prefix": "folder_1/" + filePrefix }, function (err, data) {
/* `data` will look roughly like:

  {
    Prefix: 'my-prefix',
    IsTruncated: true,
    MaxKeys: 1000,
    Contents: [
      {
        Key: 'whatever'
        LastModified: new Date(2012, 11, 25, 0, 0, 0),
        ETag: 'whatever',
        Size: 123,
        Owner: 'you',
        StorageClass: 'whatever'
      },
      ⋮
    ]
  }

  */
}