@google-cloud/storage
Advanced tools
Comparing version 7.2.0 to 7.3.0
@@ -76,3 +76,3 @@ /*! | ||
* @param {Bucket} bucket A {@link Bucket} instance | ||
* @experimental | ||
* | ||
*/ | ||
@@ -91,3 +91,3 @@ export declare class TransferManager { | ||
* to each individual upload operation. | ||
* @experimental | ||
* | ||
*/ | ||
@@ -121,3 +121,3 @@ /** | ||
* ``` | ||
* @experimental | ||
* | ||
*/ | ||
@@ -133,3 +133,3 @@ uploadManyFiles(filePathsOrDirectory: string[] | string, options?: UploadManyFilesOptions): Promise<UploadResponse[]>; | ||
* to each individual download operation. | ||
* @experimental | ||
* | ||
*/ | ||
@@ -166,3 +166,3 @@ /** | ||
* ``` | ||
* @experimental | ||
* | ||
*/ | ||
@@ -176,3 +176,3 @@ downloadManyFiles(filesOrFolder: File[] | string[] | string, options?: DownloadManyFilesOptions): Promise<void | DownloadResponse[]>; | ||
* @property {string | boolean} [validation] Whether or not to perform a CRC32C validation check when download is complete. | ||
* @experimental | ||
* | ||
*/ | ||
@@ -201,3 +201,3 @@ /** | ||
* ``` | ||
* @experimental | ||
* | ||
*/ | ||
@@ -220,3 +220,3 @@ downloadFileInChunks(fileOrName: File | string, options?: DownloadFileInChunksOptions): Promise<void | DownloadResponse>; | ||
* failures will be automatically aborted. | ||
* @experimental | ||
* | ||
*/ | ||
@@ -248,3 +248,3 @@ /** | ||
* | ||
* @experimental | ||
* | ||
*/ | ||
@@ -251,0 +251,0 @@ uploadFileInChunks(filePath: string, options?: UploadFileInChunksOptions, generator?: MultiPartHelperGenerator): Promise<GaxiosResponse | undefined>; |
@@ -38,18 +38,18 @@ "use strict"; | ||
* Default number of concurrently executing promises to use when calling uploadManyFiles. | ||
* @experimental | ||
* | ||
*/ | ||
const DEFAULT_PARALLEL_UPLOAD_LIMIT = 2; | ||
const DEFAULT_PARALLEL_UPLOAD_LIMIT = 5; | ||
/** | ||
* Default number of concurrently executing promises to use when calling downloadManyFiles. | ||
* @experimental | ||
* | ||
*/ | ||
const DEFAULT_PARALLEL_DOWNLOAD_LIMIT = 2; | ||
const DEFAULT_PARALLEL_DOWNLOAD_LIMIT = 5; | ||
/** | ||
* Default number of concurrently executing promises to use when calling downloadFileInChunks. | ||
* @experimental | ||
* | ||
*/ | ||
const DEFAULT_PARALLEL_CHUNKED_DOWNLOAD_LIMIT = 2; | ||
const DEFAULT_PARALLEL_CHUNKED_DOWNLOAD_LIMIT = 5; | ||
/** | ||
* The minimum size threshold in bytes at which to apply a chunked download strategy when calling downloadFileInChunks. | ||
* @experimental | ||
* | ||
*/ | ||
@@ -59,8 +59,8 @@ const DOWNLOAD_IN_CHUNKS_FILE_SIZE_THRESHOLD = 32 * 1024 * 1024; | ||
* The chunk size in bytes to use when calling downloadFileInChunks. | ||
* @experimental | ||
* | ||
*/ | ||
const DOWNLOAD_IN_CHUNKS_DEFAULT_CHUNK_SIZE = 10 * 1024 * 1024; | ||
const DOWNLOAD_IN_CHUNKS_DEFAULT_CHUNK_SIZE = 32 * 1024 * 1024; | ||
/** | ||
* The chunk size in bytes to use when calling uploadFileInChunks. | ||
* @experimental | ||
* | ||
*/ | ||
@@ -70,5 +70,5 @@ const UPLOAD_IN_CHUNKS_DEFAULT_CHUNK_SIZE = 32 * 1024 * 1024; | ||
* Default number of concurrently executing promises to use when calling uploadFileInChunks. | ||
* @experimental | ||
* | ||
*/ | ||
const DEFAULT_PARALLEL_CHUNKED_UPLOAD_LIMIT = 2; | ||
const DEFAULT_PARALLEL_CHUNKED_UPLOAD_LIMIT = 5; | ||
const EMPTY_REGEX = '(?:)'; | ||
@@ -103,3 +103,3 @@ /** | ||
* @private | ||
* @experimental | ||
* | ||
*/ | ||
@@ -275,3 +275,3 @@ class XMLMultiPartUploadHelper { | ||
* @param {Bucket} bucket A {@link Bucket} instance | ||
* @experimental | ||
* | ||
*/ | ||
@@ -291,3 +291,3 @@ class TransferManager { | ||
* to each individual upload operation. | ||
* @experimental | ||
* | ||
*/ | ||
@@ -321,3 +321,3 @@ /** | ||
* ``` | ||
* @experimental | ||
* | ||
*/ | ||
@@ -375,3 +375,3 @@ async uploadManyFiles(filePathsOrDirectory, options = {}) { | ||
* to each individual download operation. | ||
* @experimental | ||
* | ||
*/ | ||
@@ -408,3 +408,3 @@ /** | ||
* ``` | ||
* @experimental | ||
* | ||
*/ | ||
@@ -454,3 +454,3 @@ async downloadManyFiles(filesOrFolder, options = {}) { | ||
* @property {string | boolean} [validation] Whether or not to perform a CRC32C validation check when download is complete. | ||
* @experimental | ||
* | ||
*/ | ||
@@ -479,3 +479,3 @@ /** | ||
* ``` | ||
* @experimental | ||
* | ||
*/ | ||
@@ -498,3 +498,3 @@ async downloadFileInChunks(fileOrName, options = {}) { | ||
const filePath = options.destination || path.basename(file.name); | ||
const fileToWrite = await fs_1.promises.open(filePath, 'w+'); | ||
const fileToWrite = await fs_1.promises.open(filePath, 'w'); | ||
while (start < size) { | ||
@@ -504,33 +504,24 @@ const chunkStart = start; | ||
chunkEnd = chunkEnd > size ? size : chunkEnd; | ||
promises.push(limit(() => file | ||
.download({ | ||
start: chunkStart, | ||
end: chunkEnd, | ||
[util_1.GCCL_GCS_CMD_KEY]: GCCL_GCS_CMD_FEATURE.DOWNLOAD_SHARDED, | ||
}) | ||
.then(resp => { | ||
promises.push(limit(async () => { | ||
const resp = await file.download({ | ||
start: chunkStart, | ||
end: chunkEnd, | ||
[util_1.GCCL_GCS_CMD_KEY]: GCCL_GCS_CMD_FEATURE.DOWNLOAD_SHARDED, | ||
}); | ||
return fileToWrite.write(resp[0], 0, resp[0].length, chunkStart); | ||
}))); | ||
})); | ||
start += chunkSize; | ||
} | ||
return new Promise((resolve, reject) => { | ||
let results; | ||
Promise.all(promises) | ||
.then(data => { | ||
results = data.map(result => result.buffer); | ||
if (options.validation === 'crc32c') { | ||
return crc32c_1.CRC32C.fromFile(filePath); | ||
} | ||
return; | ||
}) | ||
.then(() => { | ||
resolve(results); | ||
}) | ||
.catch(e => { | ||
reject(e); | ||
}) | ||
.finally(() => { | ||
fileToWrite.close(); | ||
}); | ||
}); | ||
let results; | ||
try { | ||
const data = await Promise.all(promises); | ||
results = data.map(result => result.buffer); | ||
if (options.validation === 'crc32c') { | ||
await crc32c_1.CRC32C.fromFile(filePath); | ||
} | ||
return results; | ||
} | ||
finally { | ||
fileToWrite.close(); | ||
} | ||
} | ||
@@ -552,3 +543,3 @@ /** | ||
* failures will be automatically aborted. | ||
* @experimental | ||
* | ||
*/ | ||
@@ -580,3 +571,3 @@ /** | ||
* | ||
* @experimental | ||
* | ||
*/ | ||
@@ -583,0 +574,0 @@ async uploadFileInChunks(filePath, options = {}, generator = defaultMultiPartGenerator) { |
{ | ||
"name": "@google-cloud/storage", | ||
"description": "Cloud Storage Client Library for Node.js", | ||
"version": "7.2.0", | ||
"version": "7.3.0", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "author": "Google Inc.", |
@@ -134,3 +134,3 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
| Download File | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/downloadFile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/downloadFile.js,samples/README.md) | | ||
| Download a File in Chunks Utilzing Transfer Manager | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/downloadFileInChunksWithTransferManager.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/downloadFileInChunksWithTransferManager.js,samples/README.md) | | ||
| Download a File in Chunks With Transfer Manager | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/downloadFileInChunksWithTransferManager.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/downloadFileInChunksWithTransferManager.js,samples/README.md) | | ||
| Download File Using Requester Pays | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/downloadFileUsingRequesterPays.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/downloadFileUsingRequesterPays.js,samples/README.md) | | ||
@@ -213,2 +213,3 @@ | Download Folder With Transfer Manager | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/downloadFolderWithTransferManager.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/downloadFolderWithTransferManager.js,samples/README.md) | | ||
| Upload File | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/uploadFile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/uploadFile.js,samples/README.md) | | ||
| Upload a File in Chunks With Transfer Manager | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/uploadFileInChunksWithTransferManager.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/uploadFileInChunksWithTransferManager.js,samples/README.md) | | ||
| Upload File With Kms Key | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/uploadFileWithKmsKey.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/uploadFileWithKmsKey.js,samples/README.md) | | ||
@@ -215,0 +216,0 @@ | Upload From Memory | [source code](https://github.com/googleapis/nodejs-storage/blob/main/samples/uploadFromMemory.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/uploadFromMemory.js,samples/README.md) | |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
875250
289
17616