Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af95729

Browse files
[storage] doc fix (Azure#13087)
* use uploadData instead of uploadBrowserData in samples: Fixes Azure#12939 * fix client constructor doc: fixes MicrosoftDocs/azure-docs-sdk-node#1003 * Fix doc for Azure#7097 * Mention InteractiveBrowserCredential in aad sample * Update sdk/storage/storage-blob/samples/javascript/advanced.js Co-authored-by: Jeremy Meng <[email protected]> Co-authored-by: Jeremy Meng <[email protected]>
1 parent ea1eef0 commit af95729

File tree

15 files changed

+50
-38
lines changed

15 files changed

+50
-38
lines changed

sdk/storage/storage-blob/samples/browserSamples/largeFileUploads.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ async function upload() {
103103
);
104104

105105
const file = document.getElementById("file").files[0];
106-
await blockBlobClient.uploadBrowserData(file, {
106+
await blockBlobClient.uploadData(file, {
107107
maxSingleShotSize: 4 * 1024 * 1024
108108
});
109109
}

sdk/storage/storage-blob/samples/javascript/advanced.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ async function main() {
8585
);
8686
}
8787

88-
// Parallel uploading a browser File/Blob/ArrayBuffer in browsers with BlockBlobClient.uploadBrowserData()
89-
// Uncomment following code in browsers because BlockBlobClient.uploadBrowserData() is only available in browsers
88+
// Parallel uploading a browser File/Blob/ArrayBuffer in browsers with BlockBlobClient.uploadData()
89+
// Uncomment following code in browsers because document.getElementById() is only available in browsers
9090
/*
9191
const browserFile = document.getElementById("fileinput").files[0];
92-
await blockBlobClient.uploadBrowserData(browserFile, {
92+
await blockBlobClient.uploadData(browserFile, {
9393
blockSize: 4 * 1024 * 1024, // 4MB block size
9494
concurrency: 20, // 20 concurrency
9595
onProgress: ev => console.log(ev)

sdk/storage/storage-blob/samples/javascript/azureAdAuth.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
/*
55
ONLY AVAILABLE IN NODE.JS RUNTIME
6+
If you are using the browser, you can use the InteractiveBrowserCredential provided via @azure/identity or any other feasible implementation of TokenCredential.
67
78
Setup :
89
- Reference - Authorize access to blobs and queues with Azure Active Directory from a client application
@@ -44,6 +45,7 @@ async function main() {
4445
}
4546

4647
// ONLY AVAILABLE IN NODE.JS RUNTIME
48+
// If you are using the browser, you can use the InteractiveBrowserCredential provided via @azure/identity or any other feasible implementation of TokenCredential.
4749
// DefaultAzureCredential will first look for Azure Active Directory (AAD)
4850
// client secret credentials in the following environment variables:
4951
//

sdk/storage/storage-blob/samples/javascript/basic.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ async function main() {
2020
const sharedKeyCredential = new StorageSharedKeyCredential(account, accountKey);
2121

2222
// ONLY AVAILABLE IN NODE.JS RUNTIME
23+
// If you are using the browser, you can use the InteractiveBrowserCredential provided via @azure/identity or any other feasible implementation of TokenCredential.
2324
// DefaultAzureCredential will first look for Azure Active Directory (AAD)
2425
// client secret credentials in the following environment variables:
2526
//

sdk/storage/storage-blob/samples/typescript/src/advanced.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ export async function main() {
8585
);
8686
}
8787

88-
// Parallel uploading a browser File/Blob/ArrayBuffer in browsers with BlockBlobClient.uploadBrowserData()
89-
// Uncomment following code in browsers because BlockBlobClient.uploadBrowserData() is only available in browsers
88+
// Parallel uploading a browser File/Blob/ArrayBuffer in browsers with BlockBlobClient.uploadData()
89+
// Uncomment following code in browsers because document is only available in browsers
9090
/*
9191
const browserFile = document.getElementById("fileinput").files[0];
92-
await blockBlobClient.uploadBrowserData(browserFile, {
92+
await blockBlobClient.uploadData(browserFile, {
9393
blockSize: 4 * 1024 * 1024, // 4MB block size
9494
concurrency: 20, // 20 concurrency
9595
onProgress: ev => console.log(ev)

sdk/storage/storage-blob/samples/typescript/src/azureAdAuth.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
/*
55
ONLY AVAILABLE IN NODE.JS RUNTIME
6+
If you are using the browser, you can use the InteractiveBrowserCredential provided via @azure/identity or any other feasible implementation of TokenCredential.
67
78
Setup :
89
- Reference - Authorize access to blobs and queues with Azure Active Directory from a client application
@@ -45,6 +46,7 @@ export async function main() {
4546
}
4647

4748
// ONLY AVAILABLE IN NODE.JS RUNTIME
49+
// If you are using the browser, you can use the InteractiveBrowserCredential provided via @azure/identity or any other feasible implementation of TokenCredential.
4850
// DefaultAzureCredential will first look for Azure Active Directory (AAD)
4951
// client secret credentials in the following environment variables:
5052
//

sdk/storage/storage-blob/samples/typescript/src/basic.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export async function main() {
2525
const sharedKeyCredential = new StorageSharedKeyCredential(account, accountKey);
2626

2727
// ONLY AVAILABLE IN NODE.JS RUNTIME
28+
// If you are using the browser, you can use the InteractiveBrowserCredential provided via @azure/identity or any other feasible implementation of TokenCredential.
2829
// DefaultAzureCredential will first look for Azure Active Directory (AAD)
2930
// client secret credentials in the following environment variables:
3031
//

sdk/storage/storage-blob/src/Clients.ts

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5571,9 +5571,9 @@ export class PageBlobClient extends BlobClient {
55715571
* Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped.
55725572
* If a blob name includes ? or %, blob name must be encoded in the URL.
55735573
*
5574-
* @param {string} url A Client string pointing to Azure Storage blob service, such as
5575-
* "https://myaccount.blob.core.windows.net". You can append a SAS
5576-
* if using AnonymousCredential, such as "https://myaccount.blob.core.windows.net?sasString".
5574+
* @param {string} url A Client string pointing to Azure Storage page blob, such as
5575+
* "https://myaccount.blob.core.windows.net/mycontainer/pageblob". You can append a SAS
5576+
* if using AnonymousCredential, such as "https://myaccount.blob.core.windows.net/mycontainer/pageblob?sasString".
55775577
* @param {StorageSharedKeyCredential | AnonymousCredential | TokenCredential} credential Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the @azure/identity package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.
55785578
* @param {StoragePipelineOptions} [options] Optional. Options to configure the HTTP pipeline.
55795579
* @memberof PageBlobClient
@@ -5586,10 +5586,10 @@ export class PageBlobClient extends BlobClient {
55865586
/**
55875587
* Creates an instance of PageBlobClient.
55885588
*
5589-
* @param {string} url A URL string pointing to Azure Storage blob, such as
5590-
* "https://myaccount.blob.core.windows.net/mycontainer/blob".
5589+
* @param {string} url A URL string pointing to Azure Storage page blob, such as
5590+
* "https://myaccount.blob.core.windows.net/mycontainer/pageblob".
55915591
* You can append a SAS if using AnonymousCredential, such as
5592-
* "https://myaccount.blob.core.windows.net/mycontainer/blob?sasString".
5592+
* "https://myaccount.blob.core.windows.net/mycontainer/pageblob?sasString".
55935593
* This method accepts an encoded URL or non-encoded URL pointing to a blob.
55945594
* Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped.
55955595
* However, if a blob name includes ? or %, blob name must be encoded in the URL.
@@ -7293,18 +7293,14 @@ export class ContainerClient extends StorageClient {
72937293
constructor(connectionString: string, containerName: string, options?: StoragePipelineOptions);
72947294
/**
72957295
* Creates an instance of ContainerClient.
7296-
* This method accepts an encoded URL or non-encoded URL pointing to a page blob.
7296+
* This method accepts an URL pointing to a container.
72977297
* Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped.
72987298
* If a blob name includes ? or %, blob name must be encoded in the URL.
72997299
*
7300-
* @param {string} url A URL string pointing to Azure Storage page blob, such as
7301-
* "https://myaccount.blob.core.windows.net/mycontainer/pageblob". You can
7300+
* @param {string} url A URL string pointing to Azure Storage container, such as
7301+
* "https://myaccount.blob.core.windows.net/mycontainer". You can
73027302
* append a SAS if using AnonymousCredential, such as
7303-
* "https://myaccount.blob.core.windows.net/mycontainer/pageblob?sasString".
7304-
* This method accepts an encoded URL or non-encoded URL pointing to a blob.
7305-
* Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped.
7306-
* However, if a blob name includes ? or %, blob name must be encoded in the URL.
7307-
* Such as a blob named "my?blob%", the URL should be "https://myaccount.blob.core.windows.net/mycontainer/my%3Fblob%25".
7303+
* "https://myaccount.blob.core.windows.net/mycontainer?sasString".
73087304
* @param {StorageSharedKeyCredential | AnonymousCredential | TokenCredential} credential Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the @azure/identity package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.
73097305
* @param {StoragePipelineOptions} [options] Optional. Options to configure the HTTP pipeline.
73107306
* @memberof ContainerClient
@@ -7316,19 +7312,14 @@ export class ContainerClient extends StorageClient {
73167312
);
73177313
/**
73187314
* Creates an instance of ContainerClient.
7319-
* This method accepts an encoded URL or non-encoded URL pointing to a page blob.
7315+
* This method accepts an URL pointing to a container.
73207316
* Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped.
73217317
* If a blob name includes ? or %, blob name must be encoded in the URL.
73227318
*
7323-
* @param {string} url A URL string pointing to Azure Storage page blob, such as
7324-
* "https://myaccount.blob.core.windows.net/mycontainer/pageblob". You can
7319+
* @param {string} url A URL string pointing to Azure Storage container, such as
7320+
* "https://myaccount.blob.core.windows.net/mycontainer". You can
73257321
* append a SAS if using AnonymousCredential, such as
7326-
* "https://myaccount.blob.core.windows.net/mycontainer/pageblob?sasString".
7327-
* This method accepts an encoded URL or non-encoded URL pointing to a blob.
7328-
* Encoded URL string will NOT be escaped twice, only special characters in URL path will be escaped.
7329-
* However, if a blob name includes ? or %, blob name must be encoded in the URL.
7330-
7331-
* Such as a blob named "my?blob%", the URL should be "https://myaccount.blob.core.windows.net/mycontainer/my%3Fblob%25".
7322+
* "https://myaccount.blob.core.windows.net/mycontainer?sasString".
73327323
* @param {Pipeline} pipeline Call newPipeline() to create a default
73337324
* pipeline, or provide a customized pipeline.
73347325
* @memberof ContainerClient

sdk/storage/storage-file-datalake/samples/javascript/basic.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
Setup: Enter your storage account name and shared key in main()
33
*/
44

5-
const { DataLakeServiceClient, StorageSharedKeyCredential } = require("@azure/storage-file-datalake");
5+
const {
6+
DataLakeServiceClient,
7+
StorageSharedKeyCredential
8+
} = require("@azure/storage-file-datalake");
69

710
// Load the .env file if it exists
811
require("dotenv").config();
@@ -17,6 +20,7 @@ async function main() {
1720
const sharedKeyCredential = new StorageSharedKeyCredential(account, accountKey);
1821

1922
// ONLY AVAILABLE IN NODE.JS RUNTIME
23+
// If you are using the browser, you can use the InteractiveBrowserCredential provided via @azure/identity or any other feasible implementation of TokenCredential.
2024
// DefaultAzureCredential will first look for Azure Active Directory (AAD)
2125
// client secret credentials in the following environment variables:
2226
//
@@ -52,7 +56,10 @@ async function main() {
5256
const fileSystemClient = serviceClient.getFileSystemClient(fileSystemName);
5357

5458
const createFileSystemResponse = await fileSystemClient.create();
55-
console.log(`Create filesystem ${fileSystemName} successfully`, createFileSystemResponse.requestId);
59+
console.log(
60+
`Create filesystem ${fileSystemName} successfully`,
61+
createFileSystemResponse.requestId
62+
);
5663

5764
// Create a file
5865
const content = "hello";

sdk/storage/storage-file-datalake/samples/typescript/src/basic.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export async function main() {
1818
const sharedKeyCredential = new StorageSharedKeyCredential(account, accountKey);
1919

2020
// ONLY AVAILABLE IN NODE.JS RUNTIME
21+
// If you are using the browser, you can use the InteractiveBrowserCredential provided via @azure/identity or any other feasible implementation of TokenCredential.
2122
// DefaultAzureCredential will first look for Azure Active Directory (AAD)
2223
// client secret credentials in the following environment variables:
2324
//

0 commit comments

Comments
 (0)