@@ -60,6 +60,14 @@ export interface DownloadMultiCallback {
6060 ( err : Error | null , contents ?: Buffer [ ] ) : void ;
6161}
6262
63+ /**
64+ * Create a TransferManager object to perform parallel transfer operations on a Cloud Storage bucket.
65+ *
66+ * @class
67+ * @hideconstructor
68+ *
69+ * @param {Bucket } bucket A {@link Bucket} instance
70+ */
6371export class TransferManager {
6472 bucket : Bucket ;
6573 constructor ( bucket : Bucket ) {
@@ -79,6 +87,60 @@ export class TransferManager {
7987 options : UploadMultiOptions ,
8088 callback : UploadMultiCallback
8189 ) : Promise < void > ;
90+ /**
91+ * @typedef {object } UploadMultiOptions
92+ * @property {number } [concurrencyLimit] The number of concurrently executing promises
93+ * to use when uploading the files.
94+ * @property {boolean } [skipIfExists] Do not upload the file if it already exists in
95+ * the bucket. This will set the precondition ifGenerationMatch = 0.
96+ * @property {string } [prefix] A prefix to append to all of the uploaded files.
97+ * @property {object } [passthroughOptions] {@link UploadOptions } Options to be passed through
98+ * to each individual upload operation.
99+ */
100+ /**
101+ * @typedef {array } UploadResponse
102+ * @property {object } The uploaded {@link File}
103+ * @property {object } The uploaded {@link Metadata}
104+ */
105+ /**
106+ * @callback UploadMultiCallback
107+ * @param {?Error } err Rewuest error if any
108+ * @param {array } files Array of uploaded {@link File}.
109+ * @param {array } metadata Array of uploaded {@link Metadata}
110+ */
111+ /**
112+ * Upload multiple files in parallel to the bucket. This is a convenience method
113+ * that utilizes {@link Bucket#upload} to perform the upload.
114+ *
115+ * @param {array } [filePaths] An array of fully qualified paths to the files.
116+ * you wish to upload to the bucket
117+ * @param {UploadMultiOptions } [options] Configuration options.
118+ * @param {UploadMultiCallback } [callback] Callback function.
119+ * @returns {Promise<UploadResponse[] | void> }
120+ *
121+ * @example
122+ * ```
123+ * const {Storage} = require('@google-cloud/storage');
124+ * const storage = new Storage();
125+ * const bucket = storage.bucket('my-bucket');
126+ * const transferManager = new TransferManager(bucket);
127+ *
128+ * //-
129+ * // Upload multiple files.
130+ * //-
131+ * transferManager.uploadMulti(['/local/path/file1.txt, 'local/path/file2.txt'], function(err, files, metadata) {
132+ * // Your bucket now contains:
133+ * // - "file1.txt" (with the contents of '/local/path/file1.txt')
134+ * // - "file2.txt" (with the contents of '/local/path/file2.txt')
135+ * // `files` is an array of instances of File objects that refers to the new files.
136+ * });
137+ *
138+ * //-
139+ * // If the callback if omitted, we will return a Promise.
140+ * //-
141+ * const response = transferManager.uploadMulti(['/local/path/file1.txt, 'local/path/file2.txt']);
142+ * ```
143+ */
82144 async uploadMulti (
83145 filePaths : string [ ] ,
84146 optionsOrCallback ?: UploadMultiOptions | UploadMultiCallback ,
0 commit comments