|
@@ -43,6 +43,7 @@ class Uploader {
|
|
|
* @property {any=} headers
|
|
|
* @property {string=} httpMethod
|
|
|
* @property {boolean=} useFormData
|
|
|
+ * @property {number=} chunkSize
|
|
|
*
|
|
|
* @param {UploaderOptions} options
|
|
|
*/
|
|
@@ -126,6 +127,7 @@ class Uploader {
|
|
|
options: req.companion.options.providerOptions.s3,
|
|
|
} : null,
|
|
|
headers: req.body.headers,
|
|
|
+ chunkSize: req.companion.options.chunkSize,
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -194,6 +196,11 @@ class Uploader {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
+ if (options.chunkSize != null && typeof options.chunkSize !== 'number') {
|
|
|
+ this._errRespMessage = 'incorrect chunkSize'
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
const validatorOpts = { require_protocol: true, require_tld: !options.companionOptions.debug }
|
|
|
return [options.endpoint, options.uploadUrl].every((url) => {
|
|
|
if (url && !validator.isURL(url, validatorOpts)) {
|
|
@@ -426,6 +433,7 @@ class Uploader {
|
|
|
uploadLengthDeferred: false,
|
|
|
retryDelays: [0, 1000, 3000, 5000],
|
|
|
uploadSize: this.bytesWritten,
|
|
|
+ chunkSize: this.options.chunkSize,
|
|
|
headers: headerSanitize(this.options.headers),
|
|
|
addRequestId: true,
|
|
|
metadata: {
|