@google-cloud/storage
Advanced tools
Comparing version 7.11.0 to 7.11.1
@@ -19,3 +19,7 @@ /// <reference types="node" /> | ||
import { BaseMetadata, SetMetadataOptions } from './nodejs-common/service-object.js'; | ||
export type GetFilesResponse = [File[], {}, unknown]; | ||
export type GetFilesResponse = [ | ||
File[], | ||
(GetFilesOptions | {}) & Partial<Pick<GetFilesOptions, 'pageToken'>>, | ||
unknown | ||
]; | ||
export interface GetFilesCallback { | ||
@@ -22,0 +26,0 @@ (err: Error | null, files?: File[], nextQuery?: {}, apiResponse?: unknown): void; |
@@ -11,2 +11,3 @@ /// <reference types="node" /> | ||
userProject?: string; | ||
projectIdentifier?: string; | ||
} | ||
@@ -13,0 +14,0 @@ export interface ServiceAccount { |
@@ -468,3 +468,3 @@ "use strict"; | ||
} | ||
if (options.apiEndpoint) { | ||
if (options.apiEndpoint && options.apiEndpoint !== apiEndpoint) { | ||
apiEndpoint = Storage.sanitizeEndpoint(options.apiEndpoint); | ||
@@ -471,0 +471,0 @@ customEndpoint = true; |
@@ -139,3 +139,5 @@ /*! | ||
* a string is provided this will be treated as a GCS prefix and all files with that prefix will be downloaded. | ||
* @param {DownloadManyFilesOptions} [options] Configuration options. | ||
* @param {DownloadManyFilesOptions} [options] Configuration options. Setting options.prefix or options.stripPrefix | ||
* or options.passthroughOptions.destination will cause the downloaded files to be written to the file system | ||
* instead of being returned as a buffer. | ||
* @returns {Promise<DownloadResponse[]>} | ||
@@ -142,0 +144,0 @@ * |
@@ -414,3 +414,5 @@ "use strict"; | ||
* a string is provided this will be treated as a GCS prefix and all files with that prefix will be downloaded. | ||
* @param {DownloadManyFilesOptions} [options] Configuration options. | ||
* @param {DownloadManyFilesOptions} [options] Configuration options. Setting options.prefix or options.stripPrefix | ||
* or options.passthroughOptions.destination will cause the downloaded files to be written to the file system | ||
* instead of being returned as a buffer. | ||
* @returns {Promise<DownloadResponse[]>} | ||
@@ -468,3 +470,3 @@ * | ||
}; | ||
if (options.prefix) { | ||
if (options.prefix || passThroughOptionsCopy.destination) { | ||
passThroughOptionsCopy.destination = path.join(options.prefix || '', passThroughOptionsCopy.destination || '', file.name); | ||
@@ -475,3 +477,12 @@ } | ||
} | ||
promises.push(limit(() => file.download(passThroughOptionsCopy))); | ||
promises.push(limit(async () => { | ||
const destination = passThroughOptionsCopy.destination; | ||
if (destination && destination.endsWith(path.sep)) { | ||
await fs_1.promises.mkdir(destination, { recursive: true }); | ||
return Promise.resolve([ | ||
Buffer.alloc(0), | ||
]); | ||
} | ||
return file.download(passThroughOptionsCopy); | ||
})); | ||
} | ||
@@ -478,0 +489,0 @@ return Promise.all(promises); |
@@ -19,3 +19,7 @@ /// <reference types="node" /> | ||
import { BaseMetadata, SetMetadataOptions } from './nodejs-common/service-object.js'; | ||
export type GetFilesResponse = [File[], {}, unknown]; | ||
export type GetFilesResponse = [ | ||
File[], | ||
(GetFilesOptions | {}) & Partial<Pick<GetFilesOptions, 'pageToken'>>, | ||
unknown | ||
]; | ||
export interface GetFilesCallback { | ||
@@ -22,0 +26,0 @@ (err: Error | null, files?: File[], nextQuery?: {}, apiResponse?: unknown): void; |
@@ -11,2 +11,3 @@ /// <reference types="node" /> | ||
userProject?: string; | ||
projectIdentifier?: string; | ||
} | ||
@@ -13,0 +14,0 @@ export interface ServiceAccount { |
@@ -464,3 +464,3 @@ // Copyright 2019 Google LLC | ||
} | ||
if (options.apiEndpoint) { | ||
if (options.apiEndpoint && options.apiEndpoint !== apiEndpoint) { | ||
apiEndpoint = Storage.sanitizeEndpoint(options.apiEndpoint); | ||
@@ -467,0 +467,0 @@ customEndpoint = true; |
@@ -139,3 +139,5 @@ /*! | ||
* a string is provided this will be treated as a GCS prefix and all files with that prefix will be downloaded. | ||
* @param {DownloadManyFilesOptions} [options] Configuration options. | ||
* @param {DownloadManyFilesOptions} [options] Configuration options. Setting options.prefix or options.stripPrefix | ||
* or options.passthroughOptions.destination will cause the downloaded files to be written to the file system | ||
* instead of being returned as a buffer. | ||
* @returns {Promise<DownloadResponse[]>} | ||
@@ -142,0 +144,0 @@ * |
@@ -384,3 +384,5 @@ /*! | ||
* a string is provided this will be treated as a GCS prefix and all files with that prefix will be downloaded. | ||
* @param {DownloadManyFilesOptions} [options] Configuration options. | ||
* @param {DownloadManyFilesOptions} [options] Configuration options. Setting options.prefix or options.stripPrefix | ||
* or options.passthroughOptions.destination will cause the downloaded files to be written to the file system | ||
* instead of being returned as a buffer. | ||
* @returns {Promise<DownloadResponse[]>} | ||
@@ -438,3 +440,3 @@ * | ||
}; | ||
if (options.prefix) { | ||
if (options.prefix || passThroughOptionsCopy.destination) { | ||
passThroughOptionsCopy.destination = path.join(options.prefix || '', passThroughOptionsCopy.destination || '', file.name); | ||
@@ -445,3 +447,12 @@ } | ||
} | ||
promises.push(limit(() => file.download(passThroughOptionsCopy))); | ||
promises.push(limit(async () => { | ||
const destination = passThroughOptionsCopy.destination; | ||
if (destination && destination.endsWith(path.sep)) { | ||
await fsp.mkdir(destination, { recursive: true }); | ||
return Promise.resolve([ | ||
Buffer.alloc(0), | ||
]); | ||
} | ||
return file.download(passThroughOptionsCopy); | ||
})); | ||
} | ||
@@ -448,0 +459,0 @@ return Promise.all(promises); |
{ | ||
"name": "@google-cloud/storage", | ||
"description": "Cloud Storage Client Library for Node.js", | ||
"version": "7.11.0", | ||
"version": "7.11.1", | ||
"license": "Apache-2.0", | ||
@@ -98,2 +98,3 @@ "author": "Google Inc.", | ||
"@types/async-retry": "^1.4.3", | ||
"@types/duplexify": "^3.6.4", | ||
"@types/mime": "^3.0.0", | ||
@@ -100,0 +101,0 @@ "@types/mocha": "^9.1.1", |
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
1666216
36660
36