@beauraines/node-helpers 2.8.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ## [2.8.0](https://github.com/beauraines/node-helpers/compare/v2.7.1...v2.8.0) (2023-07-01)
5
+ ## [2.9.0](https://github.com/beauraines/node-helpers/compare/v2.7.1...v2.9.0) (2023-07-01)
6
6
 
7
7
 
8
8
  ### Features
9
9
 
10
10
  * adds download blob from azure helper ([08a1571](https://github.com/beauraines/node-helpers/commit/08a1571ab18b9eeeb1273e05b5abed95a7300457))
11
+ * **azure:** adds list blob command ([#42](https://github.com/beauraines/node-helpers/issues/42)) ([e60219b](https://github.com/beauraines/node-helpers/commit/e60219bf75acea70defde417a07219a1508b7c61))
11
12
  * **azure:** new getBlob function ([876716b](https://github.com/beauraines/node-helpers/commit/876716b8256b090a2eadf45c1d03b097362b2eb2))
12
13
  * **helper:** adds file write helper ([9e727e9](https://github.com/beauraines/node-helpers/commit/9e727e9ffe51525d2a73fa66ea933c1804304729))
13
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beauraines/node-helpers",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Collection of node helpers",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/azure.js CHANGED
@@ -217,6 +217,29 @@ getStorageQueueSignedURL(queueUrl,options) {
217
217
 
218
218
  }
219
219
 
220
+ /**
221
+ * Lists the blobs in a specified container, returning an array of the BlobItem object
222
+ *
223
+ * @param {string} containerName
224
+ * @returns Blob[]
225
+ */
226
+ async listBlobs(containerName) {
227
+ const blobServiceClient = new BlobServiceClient(
228
+ this.host('blob',this.cloudName),
229
+ new StorageSharedKeyCredential(this.storageAccountName, this.storageAccountKey)
230
+ );
231
+ const containerClient = blobServiceClient.getContainerClient(containerName);
232
+ let i = 1;
233
+ let blobs = []
234
+ for await (const blob of containerClient.listBlobsFlat()) {
235
+ blobs.push(blob)
236
+ }
237
+
238
+ return blobs
239
+
240
+ }
241
+
242
+
220
243
  }
221
244
 
222
245
  module.exports = AzureStorage