AWS S3 object listing

前端 未结 6 2153
南方客
南方客 2021-02-06 20:52

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

6条回答
  •  别跟我提以往
    2021-02-06 21:08

    Alternatively you can use minio-js client library, its open source & compatible with AWS S3 api.

    You can simply use list-objects.js example, additional documentation are available at https://docs.minio.io/docs/javascript-client-api-reference.

    var Minio = require('minio')
    
    var s3Client = new Minio({
      endPoint: 's3.amazonaws.com',
      accessKey: 'YOUR-ACCESSKEYID',
      secretKey: 'YOUR-SECRETACCESSKEY'
    })
    // List all object paths in bucket my-bucketname.
    var objectsStream = s3Client.listObjects('my-bucketname', '', true)
    objectsStream.on('data', function(obj) {
      console.log(obj)
    })
    objectsStream.on('error', function(e) {
      console.log(e)
    })
    

    Hope it helps.

    Disclaimer: I work for Minio

提交回复
热议问题