From f39a7c7f150e56fbda471493b0afe4d41b059009 Mon Sep 17 00:00:00 2001 From: diberry Date: Thu, 17 Dec 2020 06:22:19 -0800 Subject: [PATCH 1/6] add file content type to sample --- .../storage-blob/samples/browserSamples/largeFileUploads.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/storage/storage-blob/samples/browserSamples/largeFileUploads.js b/sdk/storage/storage-blob/samples/browserSamples/largeFileUploads.js index 82a90d513441..c0e212640319 100644 --- a/sdk/storage/storage-blob/samples/browserSamples/largeFileUploads.js +++ b/sdk/storage/storage-blob/samples/browserSamples/largeFileUploads.js @@ -104,6 +104,7 @@ async function upload() { const file = document.getElementById("file").files[0]; await blockBlobClient.uploadBrowserData(file, { - maxSingleShotSize: 4 * 1024 * 1024 + maxSingleShotSize: 4 * 1024 * 1024, + blobHTTPHeaders: { blobContentType: file.type } // set mimetype }); } From d0c6e767800178cb9f492432d135fb0fc5477dde Mon Sep 17 00:00:00 2001 From: diberry Date: Thu, 17 Dec 2020 06:36:23 -0800 Subject: [PATCH 2/6] Information about content type --- sdk/storage/storage-blob/src/Clients.ts | 40 ++++++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/sdk/storage/storage-blob/src/Clients.ts b/sdk/storage/storage-blob/src/Clients.ts index 6672b3906cc6..08e4416335dd 100644 --- a/sdk/storage/storage-blob/src/Clients.ts +++ b/sdk/storage/storage-blob/src/Clients.ts @@ -1771,7 +1771,9 @@ export class BlobClient extends StorageClient { * * @param {BlobHTTPHeaders} [blobHTTPHeaders] If no value provided, or no value provided for * the specified blob HTTP headers, these blob HTTP - * headers without a value will be cleared. + * headers without a value will be cleared. + * A common header to set is `blobContentType`, * enabling the browser to provide functionality + * based on file type. * @param {BlobSetHTTPHeadersOptions} [options] Optional options to Blob Set HTTP Headers operation. * @returns {Promise} * @memberof BlobClient @@ -2579,7 +2581,9 @@ export interface AppendBlobCreateOptions extends CommonOptions { */ conditions?: BlobRequestConditions; /** - * HTTP headers to set when creating append blobs. + * HTTP headers to set when creating append blobs. A common header + * to set is `blobContentType`, enabling the browser to provide functionality + * based on file type. * * @type {BlobHTTPHeaders} * @memberof AppendBlobCreateOptions @@ -2634,7 +2638,9 @@ export interface AppendBlobCreateIfNotExistsOptions extends CommonOptions { */ abortSignal?: AbortSignalLike; /** - * HTTP headers to set when creating append blobs. + * HTTP headers to set when creating append blobs. A common header to set is + * `blobContentType`, enabling the browser to provide functionality + * based on file type. * * @type {BlobHTTPHeaders} * @memberof AppendBlobCreateIfNotExistsOptions @@ -3309,7 +3315,9 @@ export interface BlockBlobUploadOptions extends CommonOptions { */ conditions?: BlobRequestConditions; /** - * HTTP headers to set when uploading to a block blob. + * HTTP headers to set when uploading to a block blob. A common header to set is + * `blobContentType`, enabling the browser to provide functionality + * based on file type. * * @type {BlobHTTPHeaders} * @memberof BlockBlobUploadOptions @@ -3437,8 +3445,11 @@ export interface BlockBlobSyncUploadFromURLOptions extends CommonOptions { */ copySourceBlobProperties?: boolean; /** - * HTTP headers to set when uploading to a block blob. - * + * HTTP headers to set when uploading to a block blob. + * + * A common header to set is `blobContentType`, enabling the browser to provide functionality + * based on file type. + * * @type {BlobHTTPHeaders} * @memberof BlockBlobSyncUploadFromURLOptions */ @@ -3917,6 +3928,9 @@ export interface BlockBlobUploadStreamOptions extends CommonOptions { /** * Blob HTTP Headers. + * + * A common header to set is `blobContentType`, enabling the + * browser to provide functionality based on file type. * * @type {BlobHTTPHeaders} * @memberof BlockBlobUploadStreamOptions @@ -4019,7 +4033,9 @@ export interface BlockBlobParallelUploadOptions extends CommonOptions { onProgress?: (progress: TransferProgressEvent) => void; /** - * Blob HTTP Headers. + * Blob HTTP Headers. A common header to set is + * `blobContentType`, enabling the browser to provide + * functionality based on file type. * * @type {BlobHTTPHeaders} * @memberof BlockBlobParallelUploadOptions @@ -4703,7 +4719,11 @@ export class BlockBlobClient extends BlobClient { * {@link BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}), this method will use 1 {@link upload} call to finish the upload. * Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList} * to commit the block list. - * + * + * A common {@link BlockBlobParallelUploadOptions.blobHTTPHeaders} option to set is + * `blobContentType`, enabling the browser to provide + * functionality based on file type. + * * @export * @param {Buffer | Blob | ArrayBuffer | ArrayBufferView} data Buffer(Node.js), Blob, ArrayBuffer or ArrayBufferView * @param {BlockBlobParallelUploadOptions} [options] @@ -4763,6 +4783,10 @@ export class BlockBlobClient extends BlobClient { * Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call * {@link commitBlockList} to commit the block list. * + * A common {@link BlockBlobParallelUploadOptions.blobHTTPHeaders} option to set is + * `blobContentType`, enabling the browser to provide + * functionality based on file type. + * * @deprecated Use {@link uploadData} instead. * * @export From 56695457e2ce4a533d720bfcb78d62a58a7309da Mon Sep 17 00:00:00 2001 From: diberry Date: Fri, 8 Jan 2021 08:14:41 -0800 Subject: [PATCH 3/6] remove spaces at EOL --- sdk/storage/storage-blob/src/Clients.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/storage/storage-blob/src/Clients.ts b/sdk/storage/storage-blob/src/Clients.ts index 08e4416335dd..efb4273e1888 100644 --- a/sdk/storage/storage-blob/src/Clients.ts +++ b/sdk/storage/storage-blob/src/Clients.ts @@ -1771,8 +1771,8 @@ export class BlobClient extends StorageClient { * * @param {BlobHTTPHeaders} [blobHTTPHeaders] If no value provided, or no value provided for * the specified blob HTTP headers, these blob HTTP - * headers without a value will be cleared. - * A common header to set is `blobContentType`, * enabling the browser to provide functionality + * headers without a value will be cleared. + * A common header to set is `blobContentType`,* enabling the browser to provide functionality * based on file type. * @param {BlobSetHTTPHeadersOptions} [options] Optional options to Blob Set HTTP Headers operation. * @returns {Promise} From e1bb3350885c458ba8b5cbf145e7f7e0f47d5388 Mon Sep 17 00:00:00 2001 From: diberry Date: Fri, 8 Jan 2021 09:08:29 -0800 Subject: [PATCH 4/6] still fixing --- sdk/storage/storage-blob/src/Clients.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/storage/storage-blob/src/Clients.ts b/sdk/storage/storage-blob/src/Clients.ts index efb4273e1888..822a4818d72a 100644 --- a/sdk/storage/storage-blob/src/Clients.ts +++ b/sdk/storage/storage-blob/src/Clients.ts @@ -1772,7 +1772,8 @@ export class BlobClient extends StorageClient { * @param {BlobHTTPHeaders} [blobHTTPHeaders] If no value provided, or no value provided for * the specified blob HTTP headers, these blob HTTP * headers without a value will be cleared. - * A common header to set is `blobContentType`,* enabling the browser to provide functionality + * A common header to set is `blobContentType` + * enabling the browser to provide functionality * based on file type. * @param {BlobSetHTTPHeadersOptions} [options] Optional options to Blob Set HTTP Headers operation. * @returns {Promise} From 0cd8964b97b1c7deef8a40e3528332bd8e6f4fff Mon Sep 17 00:00:00 2001 From: Ramya Achutha Rao Date: Mon, 21 Jun 2021 10:48:25 -0700 Subject: [PATCH 5/6] Fix formatting --- sdk/storage/storage-blob/src/Clients.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sdk/storage/storage-blob/src/Clients.ts b/sdk/storage/storage-blob/src/Clients.ts index 9f8e7b2a2b6b..903816e8258c 100644 --- a/sdk/storage/storage-blob/src/Clients.ts +++ b/sdk/storage/storage-blob/src/Clients.ts @@ -2833,11 +2833,11 @@ export interface BlockBlobSyncUploadFromURLOptions extends CommonOptions { */ copySourceBlobProperties?: boolean; /** - * HTTP headers to set when uploading to a block blob. - * + * HTTP headers to set when uploading to a block blob. + * * A common header to set is `blobContentType`, enabling the browser to provide functionality * based on file type. - * + * * @type {BlobHTTPHeaders} * @memberof BlockBlobSyncUploadFromURLOptions */ @@ -3141,8 +3141,8 @@ export interface BlockBlobUploadStreamOptions extends CommonOptions { /** * Blob HTTP Headers. - * - * A common header to set is `blobContentType`, enabling the + * + * A common header to set is `blobContentType`, enabling the * browser to provide functionality based on file type. * * @type {BlobHTTPHeaders} @@ -3213,8 +3213,8 @@ export interface BlockBlobParallelUploadOptions extends CommonOptions { onProgress?: (progress: TransferProgressEvent) => void; /** - * Blob HTTP Headers. A common header to set is - * `blobContentType`, enabling the browser to provide + * Blob HTTP Headers. A common header to set is + * `blobContentType`, enabling the browser to provide * functionality based on file type. * * @type {BlobHTTPHeaders} @@ -3845,11 +3845,11 @@ export class BlockBlobClient extends BlobClient { * {@link BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}), this method will use 1 {@link upload} call to finish the upload. * Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList} * to commit the block list. - * + * * A common {@link BlockBlobParallelUploadOptions.blobHTTPHeaders} option to set is * `blobContentType`, enabling the browser to provide * functionality based on file type. - * + * * @export * @param {Buffer | Blob | ArrayBuffer | ArrayBufferView} data Buffer(Node.js), Blob, ArrayBuffer or ArrayBufferView * @param {BlockBlobParallelUploadOptions} [options] @@ -3909,7 +3909,7 @@ export class BlockBlobClient extends BlobClient { * A common {@link BlockBlobParallelUploadOptions.blobHTTPHeaders} option to set is * `blobContentType`, enabling the browser to provide * functionality based on file type. - * + * * @deprecated Use {@link uploadData} instead. * * @param browserData - Blob, File, ArrayBuffer or ArrayBufferView From 2c7a780deb8ccece87b93161a167e55379cea19d Mon Sep 17 00:00:00 2001 From: Ramya Achutha Rao Date: Mon, 21 Jun 2021 11:04:57 -0700 Subject: [PATCH 6/6] Follow TSDoc --- sdk/storage/storage-blob/src/Clients.ts | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/sdk/storage/storage-blob/src/Clients.ts b/sdk/storage/storage-blob/src/Clients.ts index 903816e8258c..cf8d852f7c37 100644 --- a/sdk/storage/storage-blob/src/Clients.ts +++ b/sdk/storage/storage-blob/src/Clients.ts @@ -1367,9 +1367,7 @@ export class BlobClient extends StorageClient { * A common header to set is `blobContentType` * enabling the browser to provide functionality * based on file type. - * @param {BlobSetHTTPHeadersOptions} [options] Optional options to Blob Set HTTP Headers operation. - * @returns {Promise} - * @memberof BlobClient + * @param options - Optional options to Blob Set HTTP Headers operation. */ public async setHTTPHeaders( blobHTTPHeaders?: BlobHTTPHeaders, @@ -2144,8 +2142,6 @@ export interface AppendBlobCreateOptions extends CommonOptions { * to set is `blobContentType`, enabling the browser to provide functionality * based on file type. * - * @type {BlobHTTPHeaders} - * @memberof AppendBlobCreateOptions */ blobHTTPHeaders?: BlobHTTPHeaders; /** @@ -2183,8 +2179,6 @@ export interface AppendBlobCreateIfNotExistsOptions extends CommonOptions { * `blobContentType`, enabling the browser to provide functionality * based on file type. * - * @type {BlobHTTPHeaders} - * @memberof AppendBlobCreateIfNotExistsOptions */ blobHTTPHeaders?: BlobHTTPHeaders; /** @@ -2750,8 +2744,6 @@ export interface BlockBlobUploadOptions extends CommonOptions { * `blobContentType`, enabling the browser to provide functionality * based on file type. * - * @type {BlobHTTPHeaders} - * @memberof BlockBlobUploadOptions */ blobHTTPHeaders?: BlobHTTPHeaders; /** @@ -2838,8 +2830,6 @@ export interface BlockBlobSyncUploadFromURLOptions extends CommonOptions { * A common header to set is `blobContentType`, enabling the browser to provide functionality * based on file type. * - * @type {BlobHTTPHeaders} - * @memberof BlockBlobSyncUploadFromURLOptions */ blobHTTPHeaders?: BlobHTTPHeaders; /** @@ -3145,8 +3135,6 @@ export interface BlockBlobUploadStreamOptions extends CommonOptions { * A common header to set is `blobContentType`, enabling the * browser to provide functionality based on file type. * - * @type {BlobHTTPHeaders} - * @memberof BlockBlobUploadStreamOptions */ blobHTTPHeaders?: BlobHTTPHeaders; @@ -3217,8 +3205,6 @@ export interface BlockBlobParallelUploadOptions extends CommonOptions { * `blobContentType`, enabling the browser to provide * functionality based on file type. * - * @type {BlobHTTPHeaders} - * @memberof BlockBlobParallelUploadOptions */ blobHTTPHeaders?: BlobHTTPHeaders; @@ -3850,11 +3836,8 @@ export class BlockBlobClient extends BlobClient { * `blobContentType`, enabling the browser to provide * functionality based on file type. * - * @export - * @param {Buffer | Blob | ArrayBuffer | ArrayBufferView} data Buffer(Node.js), Blob, ArrayBuffer or ArrayBufferView - * @param {BlockBlobParallelUploadOptions} [options] - * @returns {Promise} - * @memberof BlockBlobClient + * @param data - Buffer(Node.js), Blob, ArrayBuffer or ArrayBufferView + * @param options - */ public async uploadData( data: Buffer | Blob | ArrayBuffer | ArrayBufferView,