You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -30,42 +30,25 @@ This article shows how to list blobs using the [Azure Storage client library for
30
30
31
31
When you list blobs from your code, you can specify a number of options to manage how results are returned from Azure Storage. You can specify the number of results to return in each set of results, and then retrieve the subsequent sets. You can specify a prefix to return blobs whose names begin with that character or string. And you can list blobs in a flat listing structure, or hierarchically. A hierarchical listing returns blobs as though they were organized into folders.
32
32
33
-
To list the blobs in a storage account, create a [ContainerClient](storage-blob-javascript-get-started.md#create-a-containerclient-object) then call one of these methods:
33
+
To list the blobs in a container using a flat listing, call the following method:
By default, a listing operation returns up to 5000 results at a time, but you can specify the number of results that you want each listing operation to return. The examples presented in this article show you how to return results in pages. To learn more about pagination concepts, see [Pagination with the Azure SDK for JavaScript](/azure/developer/javascript/core/use-azure-sdk#asynchronous-paging-of-results).
46
44
47
45
### Filter results with a prefix
48
46
49
-
To filter the list of blobs, specify a string for the `prefix` property in [ContainerListBlobsOptions](/javascript/api/@azure/storage-blob/containerlistblobsoptions). The prefix string can include one or more characters. Azure Storage then returns only the blobs whose names start with that prefix.
50
-
51
-
```javascript
52
-
constlistOptions= {
53
-
includeCopy:false, // include metadata from previous copies
54
-
includeDeleted:false, // include deleted blobs
55
-
includeDeletedWithVersions:false, // include deleted blobs with versions
56
-
includeLegalHold:false, // include legal hold
57
-
includeMetadata:true, // include custom metadata
58
-
includeSnapshots:true, // include snapshots
59
-
includeTags:true, // include indexable tags
60
-
includeUncommitedBlobs:false, // include uncommitted blobs
61
-
includeVersions:false, // include all blob version
62
-
prefix:''// filter by blob name prefix
63
-
};
64
-
```
47
+
To filter the list of blobs, specify a string for the `prefix` property in [ContainerListBlobsOptions](/javascript/api/@azure/storage-blob/containerlistblobsoptions). The prefix string can include one or more characters. Azure Storage then returns only the blobs whose names start with that prefix. For example, passing the prefix string `sample-` returns only blobs whose names start with `sample-`.
65
48
66
-
### Return metadata
49
+
### Include blob metadata or other information
67
50
68
-
You can return blob metadata with the results by specifying the `includeMetadata` property in the [list options](/javascript/api/@azure/storage-blob/containerlistblobsoptions).
51
+
To include blob metadata with the results, set the `includeMetadata` property to `true` as part of [ContainerListBlobsOptions](/javascript/api/@azure/storage-blob/containerlistblobsoptions). You can also include snapshots, tags, or versions in the results by setting the appropriate property to `true`.
69
52
70
53
### Flat listing versus hierarchical listing
71
54
@@ -79,60 +62,31 @@ If you name your blobs using a delimiter, then you can choose to list blobs hier
79
62
80
63
By default, a listing operation returns blobs in a flat listing. In a flat listing, blobs are not organized by virtual directory.
81
64
82
-
The following example lists the blobs in the specified container using a flat listing.
The following example lists the blobs in the specified container using a flat listing. This example includes blob snapshots and blob metadata, if they exist:
When you call a listing operation hierarchically, Azure Storage returns the virtual directories and blobs at the first level of the hierarchy.
144
98
145
-
To list blobs hierarchically, call the [BlobContainerClient.listBlobsByHierarchy](/javascript/api/@azure/storage-blob/containerclient#@azure-storage-blob-containerclient-listblobsbyhierarchy) method.
146
-
147
-
The following example lists the blobs in the specified container using a hierarchical listing, with an optional segment size specified, and writes the blob name to the console window.
148
-
149
-
```javascript
150
-
// Recursively list virtual folders and blobs
151
-
// Pass an empty string for prefixStr to list everything in the container
The following example lists the blobs in the specified container using a hierarchical listing. In this example, the prefix parameter is initially set to an empty string to list all blobs in the container. The example then calls the listing operation recursively to traverse the virtual directory hierarchy and list blobs.
To learn more about how to list blobs using the Azure Blob Storage client library for JavaScript, see the following resources.
223
143
144
+
### Code samples
145
+
146
+
- View [JavaScript](https://github.com/Azure-Samples/AzureStorageSnippets/blob/master/blobs/howto/JavaScript/NodeJS-v12/dev-guide/list-blobs.js) and [TypeScript](https://github.com/Azure-Samples/AzureStorageSnippets/blob/master/blobs/howto/TypeScript/NodeJS-v12/dev-guide/src/blobs-list.ts) code samples from this article (GitHub)
147
+
224
148
### REST API operations
225
149
226
150
The Azure SDK for JavaScript contains libraries that build on top of the Azure REST API, allowing you to interact with REST API operations through familiar JavaScript paradigms. The client library methods for listing blobs use the following REST API operation:
-[View code samples from this article (GitHub)](https://github.com/Azure-Samples/AzureStorageSnippets/blob/master/blobs/howto/JavaScript/NodeJS-v12/dev-guide/list-blobs.js)
0 commit comments