Skip to content

Commit e448b11

Browse files
Merge pull request #211028 from diberry/diberry/0913-storage-blob-url
Blob Storage - JS - Get container or blob url
2 parents 5072aee + e44f884 commit e448b11

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

articles/storage/blobs/TOC.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,8 @@ items:
590590
items:
591591
- name: Create a container
592592
href: storage-blob-container-create.md
593+
- name: Get container URL
594+
href: storage-blob-get-url-javascript.md
593595
- name: Delete and restore containers
594596
href: storage-blob-container-delete.md
595597
- name: List containers
@@ -600,6 +602,8 @@ items:
600602
items:
601603
- name: Upload blobs
602604
href: storage-blob-upload.md
605+
- name: Get blob URL
606+
href: storage-blob-get-url-javascript.md
603607
- name: Append to blobs
604608
href: storage-blob-append.md
605609
- name: Download blobs
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Get container and blob urlJavaScript - Azure Storage
3+
description: Learn how to get a container or blob URL in Azure Storage by using the JavaScript client library.
4+
services: storage
5+
author: normesta
6+
7+
ms.author: normesta
8+
ms.date: 09/13/2022
9+
ms.service: storage
10+
ms.subservice: blobs
11+
ms.topic: how-to
12+
ms.devlang: javascript
13+
ms.custom: "devx-track-javascript"
14+
---
15+
16+
# Get URL for container or blob in Azure Storage using the JavaScript client library
17+
18+
You can get a container or blob URL by using the `url` property of the client object:
19+
20+
- ContainerClient.[url](/javascript/api/@azure/storage-blob/containerclient#@azure-storage-blob-containerclient-url)
21+
- BlobClient.[url](/javascript/api/@azure/storage-blob/blobclient#@azure-storage-blob-blobclient-url)
22+
- BlockBlobClient.[url](/javascript/api/@azure/storage-blob/blockblobclien#@azure-storage-blob-blockblobclient-url)
23+
24+
25+
The [sample code snippets](https://github.com/Azure-Samples/AzureStorageSnippets/tree/master/blobs/howto/JavaScript/NodeJS-v12/dev-guide) are available in GitHub as runnable Node.js files.
26+
27+
> [!NOTE]
28+
> The examples in this article assume that you've created a [BlobServiceClient](/javascript/api/@azure/storage-blob/blobserviceclient) object by using the guidance in the [Get started with Azure Blob Storage and JavaScript](storage-blob-javascript-get-started.md) article.
29+
30+
## Get URL for container and blob
31+
32+
The following example gets a container URL and a blob URL by accessing the client's **url** property:
33+
34+
:::code language="javascript" source="~/azure_storage-snippets/blobs/howto/JavaScript/NodeJS-v12/dev-guide/get-url.js" id="Snippet_GetUrl":::
35+
36+
> [!TIP]
37+
> For loops, you must use the object's `name` property to create a client then get the URL with the client. Iterators don't return client objects, they return item objects.
38+
39+
## See also
40+
41+
- [Get started with Azure Blob Storage and JavaScript](storage-blob-javascript-get-started.md)
42+
- [DownloadStreaming]()
43+
- [Get Blob](/rest/api/storageservices/get-blob) (REST API)

0 commit comments

Comments
 (0)