Skip to content

Commit

Permalink
[storage] Add warning about limits of Node.js buffer sizes to documen…
Browse files Browse the repository at this point in the history
…tation (#6287)
  • Loading branch information
witemple-msft authored Nov 21, 2019
1 parent bf3c15b commit 8547a44
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
8 changes: 8 additions & 0 deletions sdk/storage/storage-blob/src/Clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1682,6 +1682,10 @@ export class BlobClient extends StorageClient {
* Downloads an Azure Blob in parallel to a buffer.
* Offset and count are optional, downloads the entire blob if they are not provided.
*
* Warning: Buffers can only support files up to about one gigabyte on 32-bit systems or about two
* gigabytes on 64-bit systems due to limitations of Node.js/V8. For blobs larger than this size,
* consider {@link downloadToFile}.
*
* @export
* @param {number} offset From which position of the block blob to download(in bytes)
* @param {number} [count] How much data(in bytes) to be downloaded. Will download to the end when passing undefined
Expand All @@ -1700,6 +1704,10 @@ export class BlobClient extends StorageClient {
* Downloads an Azure Blob in parallel to a buffer.
* Offset and count are optional, downloads the entire blob if they are not provided.
*
* Warning: Buffers can only support files up to about one gigabyte on 32-bit systems or about two
* gigabytes on 64-bit systems due to limitations of Node.js/V8. For blobs larger than this size,
* consider {@link downloadToFile}.
*
* @export
* @param {Buffer} buffer Buffer to be fill, must have length larger than count
* @param {number} offset From which position of the block blob to download(in bytes)
Expand Down
20 changes: 15 additions & 5 deletions sdk/storage/storage-file-share/src/ShareFileClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -966,11 +966,13 @@ export class ShareFileClient extends StorageClient {
// }, options: ${JSON.stringify(updatedOptions)}`
// );

return (await this.context.download({
abortSignal: options.abortSignal,
...updatedOptions,
spanOptions
})).readableStreamBody!;
return (
await this.context.download({
abortSignal: options.abortSignal,
...updatedOptions,
spanOptions
})
).readableStreamBody!;
},
offset,
res.contentLength!,
Expand Down Expand Up @@ -1767,6 +1769,10 @@ export class ShareFileClient extends StorageClient {
* Downloads an Azure file in parallel to a buffer.
* Offset and count are optional, pass 0 for both to download the entire file.
*
* Warning: Buffers can only support files up to about one gigabyte on 32-bit systems or about two
* gigabytes on 64-bit systems due to limitations of Node.js/V8. For files larger than this size,
* consider {@link downloadToFile}.
*
* @param {Buffer} buffer Buffer to be fill, must have length larger than count
* @param {number} offset From which position of the Azure File to download
* @param {number} [count] How much data to be downloaded. Will download to the end when passing undefined
Expand All @@ -1786,6 +1792,10 @@ export class ShareFileClient extends StorageClient {
* Downloads an Azure file in parallel to a buffer.
* Offset and count are optional, pass 0 for both to download the entire file
*
* Warning: Buffers can only support files up to about one gigabyte on 32-bit systems or about two
* gigabytes on 64-bit systems due to limitations of Node.js/V8. For files larger than this size,
* consider {@link downloadToFile}.
*
* @param {number} offset From which position of the Azure file to download
* @param {number} [count] How much data to be downloaded. Will download to the end when passing undefined
* @param {FileDownloadToBufferOptions} [options]
Expand Down

0 comments on commit 8547a44

Please sign in to comment.