Skip to content

Commit

Permalink
feat(azure): adds list blob command (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
beauraines committed Jul 1, 2023
1 parent 18883e1 commit e60219b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/azure.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,29 @@ getStorageQueueSignedURL(queueUrl,options) {

}

/**
* Lists the blobs in a specified container, returning an array of the BlobItem object
*
* @param {string} containerName
* @returns Blob[]
*/
async listBlobs(containerName) {
const blobServiceClient = new BlobServiceClient(
this.host('blob',this.cloudName),
new StorageSharedKeyCredential(this.storageAccountName, this.storageAccountKey)
);
const containerClient = blobServiceClient.getContainerClient(containerName);
let i = 1;
let blobs = []
for await (const blob of containerClient.listBlobsFlat()) {
blobs.push(blob)
}

return blobs

}


}

module.exports = AzureStorage

0 comments on commit e60219b

Please sign in to comment.