@google-cloud/storage
Advanced tools
Comparing version 7.6.0 to 7.7.0
@@ -389,3 +389,3 @@ "use strict"; | ||
qs: query, | ||
maxRetries: 0, | ||
maxRetries: 0, //explicitly set this value since this is a non-idempotent function | ||
json: { | ||
@@ -392,0 +392,0 @@ entity: options.entity, |
@@ -209,2 +209,5 @@ /// <reference types="node" /> | ||
name?: string; | ||
objectRetention?: { | ||
mode?: string; | ||
}; | ||
owner?: { | ||
@@ -211,0 +214,0 @@ entity?: string; |
@@ -251,2 +251,3 @@ /// <reference types="node" /> | ||
eventBasedHold?: boolean | null; | ||
readonly eventBasedHoldReleaseTime?: string; | ||
generation?: string | number; | ||
@@ -265,2 +266,6 @@ kmsKeyName?: string; | ||
}; | ||
retention?: { | ||
retainUntilTime?: string; | ||
mode?: string; | ||
} | null; | ||
retentionExpirationTime?: string; | ||
@@ -267,0 +272,0 @@ size?: string | number; |
@@ -424,3 +424,3 @@ "use strict"; | ||
factor: this.retryOptions.retryDelayMultiplier, | ||
maxTimeout: this.retryOptions.maxRetryDelay * 1000, | ||
maxTimeout: this.retryOptions.maxRetryDelay * 1000, //convert to milliseconds | ||
maxRetryTime: this.retryOptions.totalTimeout * 1000, //convert to milliseconds | ||
@@ -427,0 +427,0 @@ }); |
@@ -22,2 +22,3 @@ /// <reference types="node" /> | ||
userProject: string; | ||
enableObjectRetention: boolean; | ||
} | ||
@@ -86,2 +87,3 @@ export declare enum IdempotencyStrategy { | ||
dra?: boolean; | ||
enableObjectRetention?: boolean; | ||
location?: string; | ||
@@ -88,0 +90,0 @@ multiRegional?: boolean; |
@@ -600,2 +600,3 @@ "use strict"; | ||
* Availability. | ||
* @property {boolean} [enableObjectRetention=false] Specifiy whether or not object retention should be enabled on this bucket. | ||
* @property {string} [location] Specify the bucket's location. If specifying | ||
@@ -747,2 +748,6 @@ * a dual-region, the `customPlacementConfig` property should be set in conjunction. | ||
} | ||
if (body.enableObjectRetention) { | ||
query.enableObjectRetention = body.enableObjectRetention; | ||
delete body.enableObjectRetention; | ||
} | ||
this.request({ | ||
@@ -749,0 +754,0 @@ method: 'POST', |
@@ -37,2 +37,3 @@ /*! | ||
validation?: 'crc32c' | false; | ||
noReturnData?: boolean; | ||
} | ||
@@ -172,2 +173,3 @@ export interface UploadFileInChunksOptions { | ||
* @property {string | boolean} [validation] Whether or not to perform a CRC32C validation check when download is complete. | ||
* @property {boolean} [noReturnData] Whether or not to return the downloaded data. A `true` value here would be useful for files with a size that will not fit into memory. | ||
* | ||
@@ -179,5 +181,5 @@ */ | ||
* | ||
* @param {object} [file | string] {@link File} to download. | ||
* @param {File | string} fileOrName {@link File} to download. | ||
* @param {DownloadFileInChunksOptions} [options] Configuration options. | ||
* @returns {Promise<DownloadResponse>} | ||
* @returns {Promise<void | DownloadResponse>} | ||
* | ||
@@ -184,0 +186,0 @@ * @example |
@@ -51,2 +51,3 @@ "use strict"; | ||
exports.TransferManager = exports.MultiPartUploadError = void 0; | ||
const file_js_1 = require("./file.js"); | ||
const p_limit_1 = __importDefault(require("p-limit")); | ||
@@ -482,2 +483,3 @@ const path = __importStar(require("path")); | ||
* @property {string | boolean} [validation] Whether or not to perform a CRC32C validation check when download is complete. | ||
* @property {boolean} [noReturnData] Whether or not to return the downloaded data. A `true` value here would be useful for files with a size that will not fit into memory. | ||
* | ||
@@ -489,5 +491,5 @@ */ | ||
* | ||
* @param {object} [file | string] {@link File} to download. | ||
* @param {File | string} fileOrName {@link File} to download. | ||
* @param {DownloadFileInChunksOptions} [options] Configuration options. | ||
* @returns {Promise<DownloadResponse>} | ||
* @returns {Promise<void | DownloadResponse>} | ||
* | ||
@@ -513,2 +515,3 @@ * @example | ||
let limit = (0, p_limit_1.default)(options.concurrencyLimit || DEFAULT_PARALLEL_CHUNKED_DOWNLOAD_LIMIT); | ||
const noReturnData = Boolean(options.noReturnData); | ||
const promises = []; | ||
@@ -538,18 +541,27 @@ const file = typeof fileOrName === 'string' | ||
}); | ||
return fileToWrite.write(resp[0], 0, resp[0].length, chunkStart); | ||
const result = await fileToWrite.write(resp[0], 0, resp[0].length, chunkStart); | ||
if (noReturnData) | ||
return; | ||
return result.buffer; | ||
})); | ||
start += chunkSize; | ||
} | ||
let results; | ||
let chunks; | ||
try { | ||
const data = await Promise.all(promises); | ||
results = data.map(result => result.buffer); | ||
if (options.validation === 'crc32c') { | ||
await crc32c_js_1.CRC32C.fromFile(filePath); | ||
} | ||
return results; | ||
chunks = await Promise.all(promises); | ||
} | ||
finally { | ||
fileToWrite.close(); | ||
await fileToWrite.close(); | ||
} | ||
if (options.validation === 'crc32c' && fileInfo[0].metadata.crc32c) { | ||
const downloadedCrc32C = await crc32c_js_1.CRC32C.fromFile(filePath); | ||
if (!downloadedCrc32C.validate(fileInfo[0].metadata.crc32c)) { | ||
const mismatchError = new file_js_1.RequestError(file_js_1.FileExceptionMessages.DOWNLOAD_MISMATCH); | ||
mismatchError.code = 'CONTENT_DOWNLOAD_MISMATCH'; | ||
throw mismatchError; | ||
} | ||
} | ||
if (noReturnData) | ||
return; | ||
return [Buffer.concat(chunks, size)]; | ||
} | ||
@@ -556,0 +568,0 @@ /** |
@@ -385,3 +385,3 @@ // Copyright 2019 Google LLC | ||
qs: query, | ||
maxRetries: 0, | ||
maxRetries: 0, //explicitly set this value since this is a non-idempotent function | ||
json: { | ||
@@ -388,0 +388,0 @@ entity: options.entity, |
@@ -209,2 +209,5 @@ /// <reference types="node" /> | ||
name?: string; | ||
objectRetention?: { | ||
mode?: string; | ||
}; | ||
owner?: { | ||
@@ -211,0 +214,0 @@ entity?: string; |
@@ -251,2 +251,3 @@ /// <reference types="node" /> | ||
eventBasedHold?: boolean | null; | ||
readonly eventBasedHoldReleaseTime?: string; | ||
generation?: string | number; | ||
@@ -265,2 +266,6 @@ kmsKeyName?: string; | ||
}; | ||
retention?: { | ||
retainUntilTime?: string; | ||
mode?: string; | ||
} | null; | ||
retentionExpirationTime?: string; | ||
@@ -267,0 +272,0 @@ size?: string | number; |
@@ -395,3 +395,3 @@ // Copyright 2022 Google LLC | ||
factor: this.retryOptions.retryDelayMultiplier, | ||
maxTimeout: this.retryOptions.maxRetryDelay * 1000, | ||
maxTimeout: this.retryOptions.maxRetryDelay * 1000, //convert to milliseconds | ||
maxRetryTime: this.retryOptions.totalTimeout * 1000, //convert to milliseconds | ||
@@ -398,0 +398,0 @@ }); |
@@ -22,2 +22,3 @@ /// <reference types="node" /> | ||
userProject: string; | ||
enableObjectRetention: boolean; | ||
} | ||
@@ -86,2 +87,3 @@ export declare enum IdempotencyStrategy { | ||
dra?: boolean; | ||
enableObjectRetention?: boolean; | ||
location?: string; | ||
@@ -88,0 +90,0 @@ multiRegional?: boolean; |
@@ -596,2 +596,3 @@ // Copyright 2019 Google LLC | ||
* Availability. | ||
* @property {boolean} [enableObjectRetention=false] Specifiy whether or not object retention should be enabled on this bucket. | ||
* @property {string} [location] Specify the bucket's location. If specifying | ||
@@ -743,2 +744,6 @@ * a dual-region, the `customPlacementConfig` property should be set in conjunction. | ||
} | ||
if (body.enableObjectRetention) { | ||
query.enableObjectRetention = body.enableObjectRetention; | ||
delete body.enableObjectRetention; | ||
} | ||
this.request({ | ||
@@ -745,0 +750,0 @@ method: 'POST', |
@@ -37,2 +37,3 @@ /*! | ||
validation?: 'crc32c' | false; | ||
noReturnData?: boolean; | ||
} | ||
@@ -172,2 +173,3 @@ export interface UploadFileInChunksOptions { | ||
* @property {string | boolean} [validation] Whether or not to perform a CRC32C validation check when download is complete. | ||
* @property {boolean} [noReturnData] Whether or not to return the downloaded data. A `true` value here would be useful for files with a size that will not fit into memory. | ||
* | ||
@@ -179,5 +181,5 @@ */ | ||
* | ||
* @param {object} [file | string] {@link File} to download. | ||
* @param {File | string} fileOrName {@link File} to download. | ||
* @param {DownloadFileInChunksOptions} [options] Configuration options. | ||
* @returns {Promise<DownloadResponse>} | ||
* @returns {Promise<void | DownloadResponse>} | ||
* | ||
@@ -184,0 +186,0 @@ * @example |
@@ -22,2 +22,3 @@ /*! | ||
var _XMLMultiPartUploadHelper_instances, _XMLMultiPartUploadHelper_setGoogApiClientHeaders, _XMLMultiPartUploadHelper_handleErrorResponse; | ||
import { FileExceptionMessages, RequestError, } from './file.js'; | ||
import pLimit from 'p-limit'; | ||
@@ -452,2 +453,3 @@ import * as path from 'path'; | ||
* @property {string | boolean} [validation] Whether or not to perform a CRC32C validation check when download is complete. | ||
* @property {boolean} [noReturnData] Whether or not to return the downloaded data. A `true` value here would be useful for files with a size that will not fit into memory. | ||
* | ||
@@ -459,5 +461,5 @@ */ | ||
* | ||
* @param {object} [file | string] {@link File} to download. | ||
* @param {File | string} fileOrName {@link File} to download. | ||
* @param {DownloadFileInChunksOptions} [options] Configuration options. | ||
* @returns {Promise<DownloadResponse>} | ||
* @returns {Promise<void | DownloadResponse>} | ||
* | ||
@@ -483,2 +485,3 @@ * @example | ||
let limit = pLimit(options.concurrencyLimit || DEFAULT_PARALLEL_CHUNKED_DOWNLOAD_LIMIT); | ||
const noReturnData = Boolean(options.noReturnData); | ||
const promises = []; | ||
@@ -508,18 +511,27 @@ const file = typeof fileOrName === 'string' | ||
}); | ||
return fileToWrite.write(resp[0], 0, resp[0].length, chunkStart); | ||
const result = await fileToWrite.write(resp[0], 0, resp[0].length, chunkStart); | ||
if (noReturnData) | ||
return; | ||
return result.buffer; | ||
})); | ||
start += chunkSize; | ||
} | ||
let results; | ||
let chunks; | ||
try { | ||
const data = await Promise.all(promises); | ||
results = data.map(result => result.buffer); | ||
if (options.validation === 'crc32c') { | ||
await CRC32C.fromFile(filePath); | ||
} | ||
return results; | ||
chunks = await Promise.all(promises); | ||
} | ||
finally { | ||
fileToWrite.close(); | ||
await fileToWrite.close(); | ||
} | ||
if (options.validation === 'crc32c' && fileInfo[0].metadata.crc32c) { | ||
const downloadedCrc32C = await CRC32C.fromFile(filePath); | ||
if (!downloadedCrc32C.validate(fileInfo[0].metadata.crc32c)) { | ||
const mismatchError = new RequestError(FileExceptionMessages.DOWNLOAD_MISMATCH); | ||
mismatchError.code = 'CONTENT_DOWNLOAD_MISMATCH'; | ||
throw mismatchError; | ||
} | ||
} | ||
if (noReturnData) | ||
return; | ||
return [Buffer.concat(chunks, size)]; | ||
} | ||
@@ -526,0 +538,0 @@ /** |
{ | ||
"name": "@google-cloud/storage", | ||
"description": "Cloud Storage Client Library for Node.js", | ||
"version": "7.6.0", | ||
"version": "7.7.0", | ||
"license": "Apache-2.0", | ||
@@ -124,3 +124,3 @@ "author": "Google Inc.", | ||
"mockery": "^2.1.0", | ||
"nock": "~13.3.0", | ||
"nock": "~13.4.0", | ||
"node-fetch": "^2.6.7", | ||
@@ -127,0 +127,0 @@ "pack-n-play": "^2.0.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1627397
36002