@@ -33,31 +33,31 @@ const DEFAULT_PARALLEL_LARGE_FILE_DOWNLOAD_LIMIT = 2;
3333const LARGE_FILE_SIZE_THRESHOLD = 256 * 1024 * 1024 ;
3434const LARGE_FILE_DEFAULT_CHUNK_SIZE = 10 * 1024 * 1024 ;
3535const EMPTY_REGEX = '(?:)' ;
36- export interface UploadMultiOptions {
36+ export interface UploadManyFilesOptions {
3737 concurrencyLimit ?: number ;
3838 skipIfExists ?: boolean ;
3939 prefix ?: string ;
4040 passthroughOptions ?: Omit < UploadOptions , 'destination' > ;
4141}
4242
43- export interface DownloadMultiOptions {
43+ export interface DownloadManyFilesOptions {
4444 concurrencyLimit ?: number ;
4545 prefix ?: string ;
4646 stripPrefix ?: string ;
4747 passthroughOptions ?: DownloadOptions ;
4848}
4949
50- export interface LargeFileDownloadOptions {
50+ export interface DownloadFileInChunksOptions {
5151 concurrencyLimit ?: number ;
5252 chunkSizeBytes ?: number ;
53- path ?: string ;
53+ destination ?: string ;
5454}
5555
56- export interface UploadMultiCallback {
56+ export interface UploadManyFilesCallback {
5757 ( err : Error | null , files ?: File [ ] , metadata ?: Metadata [ ] ) : void ;
5858}
5959
60- export interface DownloadMultiCallback {
60+ export interface DownloadManyFilesCallback {
6161 ( err : Error | null , contents ?: Buffer [ ] ) : void ;
6262}
6363
@@ -76,21 +76,21 @@ export class TransferManager {
7676 this . bucket = bucket ;
7777 }
7878
79- async uploadMulti (
79+ async uploadManyFiles (
8080 filePaths : string [ ] ,
81- options ?: UploadMultiOptions
81+ options ?: UploadManyFilesOptions
8282 ) : Promise < UploadResponse [ ] > ;
83- async uploadMulti (
83+ async uploadManyFiles (
8484 filePaths : string [ ] ,
85- callback : UploadMultiCallback
85+ callback : UploadManyFilesCallback
8686 ) : Promise < void > ;
87- async uploadMulti (
87+ async uploadManyFiles (
8888 filePaths : string [ ] ,
89- options : UploadMultiOptions ,
90- callback : UploadMultiCallback
89+ options : UploadManyFilesOptions ,
90+ callback : UploadManyFilesCallback
9191 ) : Promise < void > ;
9292 /**
93- * @typedef {object } UploadMultiOptions
93+ * @typedef {object } UploadManyFilesOptions
9494 * @property {number } [concurrencyLimit] The number of concurrently executing promises
9595 * to use when uploading the files.
9696 * @property {boolean } [skipIfExists] Do not upload the file if it already exists in
@@ -101,7 +101,7 @@ export class TransferManager {
101101 * @experimental
102102 */
103103 /**
104- * @callback UploadMultiCallback
104+ * @callback UploadManyFilesCallback
105105 * @param {?Error } [err] Request error, if any.
106106 * @param {array } [files] Array of uploaded {@link File}.
107107 * @param {array } [metadata] Array of uploaded {@link Metadata}
@@ -113,8 +113,8 @@ export class TransferManager {
113113 *
114114 * @param {array } [filePaths] An array of fully qualified paths to the files.
115115 * to be uploaded to the bucket
116- * @param {UploadMultiOptions } [options] Configuration options.
117- * @param {UploadMultiCallback } [callback] Callback function.
116+ * @param {UploadManyFilesOptions } [options] Configuration options.
117+ * @param {UploadManyFilesCallback } [callback] Callback function.
118118 * @returns {Promise<UploadResponse[] | void> }
119119 *
120120 * @example
@@ -127,7 +127,7 @@ export class TransferManager {
127127 * //-
128128 * // Upload multiple files in parallel.
129129 * //-
130- * transferManager.uploadMulti (['/local/path/file1.txt, 'local/path/file2.txt'], function(err, files, metadata) {
130+ * transferManager.uploadManyFiles (['/local/path/file1.txt, 'local/path/file2.txt'], function(err, files, metadata) {
131131 * // Your bucket now contains:
132132 * // - "file1.txt" (with the contents of '/local/path/file1.txt')
133133 * // - "file2.txt" (with the contents of '/local/path/file2.txt')
@@ -137,16 +137,16 @@ export class TransferManager {
137137 * //-
138138 * // If the callback is omitted, we will return a promise.
139139 * //-
140- * const response = await transferManager.uploadMulti (['/local/path/file1.txt, 'local/path/file2.txt']);
140+ * const response = await transferManager.uploadManyFiles (['/local/path/file1.txt, 'local/path/file2.txt']);
141141 * ```
142142 * @experimental
143143 */
144- async uploadMulti (
144+ async uploadManyFiles (
145145 filePaths : string [ ] ,
146- optionsOrCallback ?: UploadMultiOptions | UploadMultiCallback ,
147- callback ?: UploadMultiCallback
146+ optionsOrCallback ?: UploadManyFilesOptions | UploadManyFilesCallback ,
147+ callback ?: UploadManyFilesCallback
148148 ) : Promise < void | UploadResponse [ ] > {
149- let options : UploadMultiOptions = { } ;
149+ let options : UploadManyFilesOptions = { } ;
150150 if ( typeof optionsOrCallback === 'function' ) {
151151 callback = optionsOrCallback ;
152152 } else if ( optionsOrCallback ) {
@@ -208,21 +208,21 @@ export class TransferManager {
208208 return Promise . all ( promises ) ;
209209 }
210210
211- async downloadMulti (
211+ async downloadManyFiles (
212212 files : File [ ] ,
213- options ?: DownloadMultiOptions
213+ options ?: DownloadManyFilesOptions
214214 ) : Promise < DownloadResponse [ ] > ;
215- async downloadMulti (
215+ async downloadManyFiles (
216216 files : File [ ] ,
217- callback : DownloadMultiCallback
217+ callback : DownloadManyFilesCallback
218218 ) : Promise < void > ;
219- async downloadMulti (
219+ async downloadManyFiles (
220220 files : File [ ] ,
221- options : DownloadMultiOptions ,
222- callback : DownloadMultiCallback
221+ options : DownloadManyFilesOptions ,
222+ callback : DownloadManyFilesCallback
223223 ) : Promise < void > ;
224224 /**
225- * @typedef {object } DownloadMultiOptions
225+ * @typedef {object } DownloadManyFilesOptions
226226 * @property {number } [concurrencyLimit] The number of concurrently executing promises
227227 * to use when downloading the files.
228228 * @property {string } [prefix] A prefix to append to all of the downloaded files.
@@ -232,7 +232,7 @@ export class TransferManager {
232232 * @experimental
233233 */
234234 /**
235- * @callback DownloadMultiCallback
235+ * @callback DownloadManyFilesCallback
236236 * @param {?Error } [err] Request error, if any.
237237 * @param {array } [contents] Contents of the downloaded files.
238238 * @experimental
@@ -242,8 +242,8 @@ export class TransferManager {
242242 * that utilizes {@link File#download} to perform the download.
243243 *
244244 * @param {array } [files] An array of file objects to be downloaded.
245- * @param {DownloadMultiOptions } [options] Configuration options.
246- * @param {DownloadMultiCallback } {callback } Callback function.
245+ * @param {DownloadManyFilesOptions } [options] Configuration options.
246+ * @param {DownloadManyFilesCallback } {callback } Callback function.
247247 * @returns {Promise<DownloadResponse[] | void> }
248248 *
249249 * @example
@@ -256,7 +256,7 @@ export class TransferManager {
256256 * //-
257257 * // Download multiple files in parallel.
258258 * //-
259- * transferManager.downloadMulti ([bucket.file('file1.txt'), bucket.file('file2.txt')], function(err, contents){
259+ * transferManager.downloadManyFiles ([bucket.file('file1.txt'), bucket.file('file2.txt')], function(err, contents){
260260 * // Your local directory now contains:
261261 * // - "file1.txt" (with the contents from my-bucket.file1.txt)
262262 * // - "file2.txt" (with the contents from my-bucket.file2.txt)
@@ -266,15 +266,15 @@ export class TransferManager {
266266 * //-
267267 * // If the callback is omitted, we will return a promise.
268268 * //-
269- * const response = await transferManager.downloadMulti (bucket.File('file1.txt'), bucket.File('file2.txt')]);
269+ * const response = await transferManager.downloadManyFiles (bucket.File('file1.txt'), bucket.File('file2.txt')]);
270270 * @experimental
271271 */
272- async downloadMulti (
272+ async downloadManyFiles (
273273 files : File [ ] ,
274- optionsOrCallback ?: DownloadMultiOptions | DownloadMultiCallback ,
275- callback ?: DownloadMultiCallback
274+ optionsOrCallback ?: DownloadManyFilesOptions | DownloadManyFilesCallback ,
275+ callback ?: DownloadManyFilesCallback
276276 ) : Promise < void | DownloadResponse [ ] > {
277- let options : DownloadMultiOptions = { } ;
277+ let options : DownloadManyFilesOptions = { } ;
278278 if ( typeof optionsOrCallback === 'function' ) {
279279 callback = optionsOrCallback ;
280280 } else if ( optionsOrCallback ) {
@@ -323,21 +323,21 @@ export class TransferManager {
323323 return Promise . all ( promises ) ;
324324 }
325325
326- async downloadLargeFile (
326+ async downloadFileInChunks (
327327 file : File ,
328- options ?: LargeFileDownloadOptions
328+ options ?: DownloadFileInChunksOptions
329329 ) : Promise < DownloadResponse > ;
330- async downloadLargeFile (
330+ async downloadFileInChunks (
331331 file : File ,
332332 callback : DownloadCallback
333333 ) : Promise < void > ;
334- async downloadLargeFile (
334+ async downloadFileInChunks (
335335 file : File ,
336- options : LargeFileDownloadOptions ,
336+ options : DownloadFileInChunksOptions ,
337337 callback : DownloadCallback
338338 ) : Promise < void > ;
339339 /**
340- * @typedef {object } LargeFileDownloadOptions
340+ * @typedef {object } DownloadFileInChunksOptions
341341 * @property {number } [concurrencyLimit] The number of concurrently executing promises
342342 * to use when downloading the file.
343343 * @property {number } [chunkSizeBytes] The size in bytes of each chunk to be downloaded.
@@ -348,7 +348,7 @@ export class TransferManager {
348348 * that utilizes {@link File#download} to perform the download.
349349 *
350350 * @param {object } [file] {@link File } to download.
351- * @param {LargeFileDownloadOptions } [options] Configuration options.
351+ * @param {DownloadFileInChunksOptions } [options] Configuration options.
352352 * @param {DownloadCallback } [callbac] Callback function.
353353 * @returns {Promise<DownloadResponse | void> }
354354 *
@@ -373,12 +373,12 @@ export class TransferManager {
373373 * const response = await transferManager.downloadLargeFile(bucket.file('large-file.txt');
374374 * @experimental
375375 */
376- async downloadLargeFile (
376+ async downloadFileInChunks (
377377 file : File ,
378- optionsOrCallback ?: LargeFileDownloadOptions | DownloadCallback ,
378+ optionsOrCallback ?: DownloadFileInChunksOptions | DownloadCallback ,
379379 callback ?: DownloadCallback
380380 ) : Promise < void | DownloadResponse > {
381- let options : LargeFileDownloadOptions = { } ;
381+ let options : DownloadFileInChunksOptions = { } ;
382382 if ( typeof optionsOrCallback === 'function' ) {
383383 callback = optionsOrCallback ;
384384 } else if ( optionsOrCallback ) {
@@ -400,10 +400,7 @@ export class TransferManager {
400400 }
401401
402402 let start = 0 ;
403- const filePath = path . join (
404- options . path || __dirname ,
405- path . basename ( file . name )
406- ) ;
403+ const filePath = options . destination || path . basename ( file . name ) ;
407404 const fileToWrite = await fsp . open ( filePath , 'w+' ) ;
408405 while ( start < size ) {
409406 const chunkStart = start ;
0 commit comments