@bytescale/sdk 3.46.0 → 3.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/cjs/main.js +61 -31
- package/dist/node/esm/main.mjs +62 -32
- package/dist/types/private/StreamUtils.d.ts +2 -2
- package/dist/types/private/UploadManagerBase.d.ts +1 -1
- package/dist/types/public/node/ProgressStream.d.ts +17 -0
- package/dist/types/public/node/UploadManagerNode.d.ts +1 -1
- package/package.json +1 -1
package/dist/node/cjs/main.js
CHANGED
|
@@ -2394,34 +2394,32 @@ var StreamUtils = /*#__PURE__*/function () {
|
|
|
2394
2394
|
return StreamUtils_createClass(StreamUtils, null, [{
|
|
2395
2395
|
key: "create",
|
|
2396
2396
|
value: function create() {
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2397
|
+
return new external_stream_namespaceObject.Readable({
|
|
2398
|
+
read: function read(_size) {
|
|
2399
|
+
// No implementation needed here.
|
|
2400
|
+
// The stream will wait for data to be pushed externally.
|
|
2401
|
+
}
|
|
2402
|
+
});
|
|
2400
2403
|
}
|
|
2401
2404
|
}, {
|
|
2402
|
-
key: "
|
|
2403
|
-
value: function
|
|
2404
|
-
|
|
2405
|
-
StreamUtils.endStream(readable);
|
|
2406
|
-
return readable;
|
|
2405
|
+
key: "endStream",
|
|
2406
|
+
value: function endStream(readable) {
|
|
2407
|
+
readable.push(null);
|
|
2407
2408
|
}
|
|
2408
2409
|
}, {
|
|
2409
|
-
key: "
|
|
2410
|
-
value: function
|
|
2411
|
-
return
|
|
2410
|
+
key: "empty",
|
|
2411
|
+
value: function empty() {
|
|
2412
|
+
return external_stream_namespaceObject.Readable.from([]);
|
|
2412
2413
|
}
|
|
2413
2414
|
}, {
|
|
2414
2415
|
key: "fromBuffer",
|
|
2415
2416
|
value: function fromBuffer(buffer) {
|
|
2416
|
-
|
|
2417
|
-
readable.push(buffer);
|
|
2418
|
-
StreamUtils.endStream(readable);
|
|
2419
|
-
return readable;
|
|
2417
|
+
return external_stream_namespaceObject.Readable.from(buffer);
|
|
2420
2418
|
}
|
|
2421
2419
|
}, {
|
|
2422
|
-
key: "
|
|
2423
|
-
value: function
|
|
2424
|
-
|
|
2420
|
+
key: "fromArrayBuffer",
|
|
2421
|
+
value: function fromArrayBuffer(buffer) {
|
|
2422
|
+
return StreamUtils.fromBuffer(Buffer.from(buffer));
|
|
2425
2423
|
}
|
|
2426
2424
|
}]);
|
|
2427
2425
|
}();
|
|
@@ -2670,6 +2668,45 @@ var UploadManagerFetchUtils = /*#__PURE__*/function () {
|
|
|
2670
2668
|
}
|
|
2671
2669
|
}]);
|
|
2672
2670
|
}();
|
|
2671
|
+
;// CONCATENATED MODULE: ./src/public/node/ProgressStream.ts
|
|
2672
|
+
function ProgressStream_typeof(o) { "@babel/helpers - typeof"; return ProgressStream_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, ProgressStream_typeof(o); }
|
|
2673
|
+
function ProgressStream_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2674
|
+
function ProgressStream_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, ProgressStream_toPropertyKey(descriptor.key), descriptor); } }
|
|
2675
|
+
function ProgressStream_createClass(Constructor, protoProps, staticProps) { if (protoProps) ProgressStream_defineProperties(Constructor.prototype, protoProps); if (staticProps) ProgressStream_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
2676
|
+
function ProgressStream_toPropertyKey(t) { var i = ProgressStream_toPrimitive(t, "string"); return "symbol" == ProgressStream_typeof(i) ? i : i + ""; }
|
|
2677
|
+
function ProgressStream_toPrimitive(t, r) { if ("object" != ProgressStream_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != ProgressStream_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
2678
|
+
function ProgressStream_callSuper(t, o, e) { return o = ProgressStream_getPrototypeOf(o), ProgressStream_possibleConstructorReturn(t, ProgressStream_isNativeReflectConstruct() ? Reflect.construct(o, e || [], ProgressStream_getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
2679
|
+
function ProgressStream_possibleConstructorReturn(self, call) { if (call && (ProgressStream_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return ProgressStream_assertThisInitialized(self); }
|
|
2680
|
+
function ProgressStream_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
2681
|
+
function ProgressStream_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (ProgressStream_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
2682
|
+
function ProgressStream_getPrototypeOf(o) { ProgressStream_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ProgressStream_getPrototypeOf(o); }
|
|
2683
|
+
function ProgressStream_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) ProgressStream_setPrototypeOf(subClass, superClass); }
|
|
2684
|
+
function ProgressStream_setPrototypeOf(o, p) { ProgressStream_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ProgressStream_setPrototypeOf(o, p); }
|
|
2685
|
+
|
|
2686
|
+
var ProgressStream = /*#__PURE__*/function (_Transform) {
|
|
2687
|
+
function ProgressStream(options) {
|
|
2688
|
+
var _this;
|
|
2689
|
+
ProgressStream_classCallCheck(this, ProgressStream);
|
|
2690
|
+
_this = ProgressStream_callSuper(this, ProgressStream, [options]);
|
|
2691
|
+
_this.totalBytes = 0;
|
|
2692
|
+
_this.onProgress = options === null || options === void 0 ? void 0 : options.onProgress;
|
|
2693
|
+
return _this;
|
|
2694
|
+
}
|
|
2695
|
+
ProgressStream_inherits(ProgressStream, _Transform);
|
|
2696
|
+
return ProgressStream_createClass(ProgressStream, [{
|
|
2697
|
+
key: "_transform",
|
|
2698
|
+
value: function _transform(chunk, _encoding, callback) {
|
|
2699
|
+
this.totalBytes += chunk.length;
|
|
2700
|
+
// Invoke the progress callback if provided
|
|
2701
|
+
if (this.onProgress !== undefined) {
|
|
2702
|
+
this.onProgress(this.totalBytes);
|
|
2703
|
+
}
|
|
2704
|
+
// Pass the chunk along
|
|
2705
|
+
this.push(chunk);
|
|
2706
|
+
callback();
|
|
2707
|
+
}
|
|
2708
|
+
}]);
|
|
2709
|
+
}(external_stream_namespaceObject.Transform);
|
|
2673
2710
|
;// CONCATENATED MODULE: ./src/public/node/UploadManagerNode.ts
|
|
2674
2711
|
function UploadManagerNode_typeof(o) { "@babel/helpers - typeof"; return UploadManagerNode_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, UploadManagerNode_typeof(o); }
|
|
2675
2712
|
function UploadManagerNode_empty() {}
|
|
@@ -2870,6 +2907,7 @@ function UploadManagerNode_setPrototypeOf(o, p) { UploadManagerNode_setPrototype
|
|
|
2870
2907
|
|
|
2871
2908
|
|
|
2872
2909
|
|
|
2910
|
+
|
|
2873
2911
|
var UploadManager = /*#__PURE__*/function (_UploadManagerBase) {
|
|
2874
2912
|
function UploadManager() {
|
|
2875
2913
|
UploadManagerNode_classCallCheck(this, UploadManager);
|
|
@@ -2974,20 +3012,12 @@ var UploadManager = /*#__PURE__*/function (_UploadManagerBase) {
|
|
|
2974
3012
|
value: function doPutUploadPart(part, contentLength, source, onProgress, addCancellationHandler) {
|
|
2975
3013
|
try {
|
|
2976
3014
|
var _this = this;
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
return UploadManagerNode_await(_this.sliceDataForRequest(source, part), function (stream) {
|
|
2981
|
-
var streamWithProgress = stream.on("data", function (data) {
|
|
2982
|
-
if (data.byteLength !== undefined) {
|
|
2983
|
-
bytesSent += data.byteLength;
|
|
2984
|
-
onProgress(bytesSent);
|
|
2985
|
-
} else if (!hasWarned) {
|
|
2986
|
-
hasWarned = true;
|
|
2987
|
-
console.warn("Expected stream to contain buffers, but it did not, so upload progress won't be reported.");
|
|
2988
|
-
}
|
|
3015
|
+
return UploadManagerNode_await(_this.sliceDataForRequest(source, part), function (inputStream) {
|
|
3016
|
+
var progressStream = new ProgressStream({
|
|
3017
|
+
onProgress: onProgress
|
|
2989
3018
|
});
|
|
2990
|
-
|
|
3019
|
+
inputStream.pipe(progressStream);
|
|
3020
|
+
return UploadManagerNode_await(UploadManagerFetchUtils.doPutUploadPart(_this.config, part, _this.coerceRequestBody(progressStream), contentLength, addCancellationHandler));
|
|
2991
3021
|
});
|
|
2992
3022
|
} catch (e) {
|
|
2993
3023
|
return Promise.reject(e);
|
package/dist/node/esm/main.mjs
CHANGED
|
@@ -2369,7 +2369,7 @@ var x = function(y) {
|
|
|
2369
2369
|
var x = {}; __lib_require__.d(x, y); return x
|
|
2370
2370
|
}
|
|
2371
2371
|
var y = function(x) { return function() { return x; }; }
|
|
2372
|
-
var external_stream_namespaceObject = x({ ["Readable"]: function() { return __WEBPACK_EXTERNAL_MODULE_stream__.Readable; } });
|
|
2372
|
+
var external_stream_namespaceObject = x({ ["Readable"]: function() { return __WEBPACK_EXTERNAL_MODULE_stream__.Readable; }, ["Transform"]: function() { return __WEBPACK_EXTERNAL_MODULE_stream__.Transform; } });
|
|
2373
2373
|
;// CONCATENATED MODULE: ./src/private/StreamUtils.ts
|
|
2374
2374
|
function StreamUtils_typeof(o) { "@babel/helpers - typeof"; return StreamUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, StreamUtils_typeof(o); }
|
|
2375
2375
|
function StreamUtils_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -2385,34 +2385,32 @@ var StreamUtils = /*#__PURE__*/function () {
|
|
|
2385
2385
|
return StreamUtils_createClass(StreamUtils, null, [{
|
|
2386
2386
|
key: "create",
|
|
2387
2387
|
value: function create() {
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2388
|
+
return new external_stream_namespaceObject.Readable({
|
|
2389
|
+
read: function read(_size) {
|
|
2390
|
+
// No implementation needed here.
|
|
2391
|
+
// The stream will wait for data to be pushed externally.
|
|
2392
|
+
}
|
|
2393
|
+
});
|
|
2391
2394
|
}
|
|
2392
2395
|
}, {
|
|
2393
|
-
key: "
|
|
2394
|
-
value: function
|
|
2395
|
-
|
|
2396
|
-
StreamUtils.endStream(readable);
|
|
2397
|
-
return readable;
|
|
2396
|
+
key: "endStream",
|
|
2397
|
+
value: function endStream(readable) {
|
|
2398
|
+
readable.push(null);
|
|
2398
2399
|
}
|
|
2399
2400
|
}, {
|
|
2400
|
-
key: "
|
|
2401
|
-
value: function
|
|
2402
|
-
return
|
|
2401
|
+
key: "empty",
|
|
2402
|
+
value: function empty() {
|
|
2403
|
+
return external_stream_namespaceObject.Readable.from([]);
|
|
2403
2404
|
}
|
|
2404
2405
|
}, {
|
|
2405
2406
|
key: "fromBuffer",
|
|
2406
2407
|
value: function fromBuffer(buffer) {
|
|
2407
|
-
|
|
2408
|
-
readable.push(buffer);
|
|
2409
|
-
StreamUtils.endStream(readable);
|
|
2410
|
-
return readable;
|
|
2408
|
+
return external_stream_namespaceObject.Readable.from(buffer);
|
|
2411
2409
|
}
|
|
2412
2410
|
}, {
|
|
2413
|
-
key: "
|
|
2414
|
-
value: function
|
|
2415
|
-
|
|
2411
|
+
key: "fromArrayBuffer",
|
|
2412
|
+
value: function fromArrayBuffer(buffer) {
|
|
2413
|
+
return StreamUtils.fromBuffer(Buffer.from(buffer));
|
|
2416
2414
|
}
|
|
2417
2415
|
}]);
|
|
2418
2416
|
}();
|
|
@@ -2665,6 +2663,45 @@ var UploadManagerFetchUtils = /*#__PURE__*/function () {
|
|
|
2665
2663
|
}
|
|
2666
2664
|
}]);
|
|
2667
2665
|
}();
|
|
2666
|
+
;// CONCATENATED MODULE: ./src/public/node/ProgressStream.ts
|
|
2667
|
+
function ProgressStream_typeof(o) { "@babel/helpers - typeof"; return ProgressStream_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, ProgressStream_typeof(o); }
|
|
2668
|
+
function ProgressStream_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2669
|
+
function ProgressStream_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, ProgressStream_toPropertyKey(descriptor.key), descriptor); } }
|
|
2670
|
+
function ProgressStream_createClass(Constructor, protoProps, staticProps) { if (protoProps) ProgressStream_defineProperties(Constructor.prototype, protoProps); if (staticProps) ProgressStream_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
2671
|
+
function ProgressStream_toPropertyKey(t) { var i = ProgressStream_toPrimitive(t, "string"); return "symbol" == ProgressStream_typeof(i) ? i : i + ""; }
|
|
2672
|
+
function ProgressStream_toPrimitive(t, r) { if ("object" != ProgressStream_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != ProgressStream_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
2673
|
+
function ProgressStream_callSuper(t, o, e) { return o = ProgressStream_getPrototypeOf(o), ProgressStream_possibleConstructorReturn(t, ProgressStream_isNativeReflectConstruct() ? Reflect.construct(o, e || [], ProgressStream_getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
2674
|
+
function ProgressStream_possibleConstructorReturn(self, call) { if (call && (ProgressStream_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return ProgressStream_assertThisInitialized(self); }
|
|
2675
|
+
function ProgressStream_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
2676
|
+
function ProgressStream_isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (ProgressStream_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
2677
|
+
function ProgressStream_getPrototypeOf(o) { ProgressStream_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ProgressStream_getPrototypeOf(o); }
|
|
2678
|
+
function ProgressStream_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) ProgressStream_setPrototypeOf(subClass, superClass); }
|
|
2679
|
+
function ProgressStream_setPrototypeOf(o, p) { ProgressStream_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ProgressStream_setPrototypeOf(o, p); }
|
|
2680
|
+
|
|
2681
|
+
var ProgressStream = /*#__PURE__*/function (_Transform) {
|
|
2682
|
+
function ProgressStream(options) {
|
|
2683
|
+
var _this;
|
|
2684
|
+
ProgressStream_classCallCheck(this, ProgressStream);
|
|
2685
|
+
_this = ProgressStream_callSuper(this, ProgressStream, [options]);
|
|
2686
|
+
_this.totalBytes = 0;
|
|
2687
|
+
_this.onProgress = options === null || options === void 0 ? void 0 : options.onProgress;
|
|
2688
|
+
return _this;
|
|
2689
|
+
}
|
|
2690
|
+
ProgressStream_inherits(ProgressStream, _Transform);
|
|
2691
|
+
return ProgressStream_createClass(ProgressStream, [{
|
|
2692
|
+
key: "_transform",
|
|
2693
|
+
value: function _transform(chunk, _encoding, callback) {
|
|
2694
|
+
this.totalBytes += chunk.length;
|
|
2695
|
+
// Invoke the progress callback if provided
|
|
2696
|
+
if (this.onProgress !== undefined) {
|
|
2697
|
+
this.onProgress(this.totalBytes);
|
|
2698
|
+
}
|
|
2699
|
+
// Pass the chunk along
|
|
2700
|
+
this.push(chunk);
|
|
2701
|
+
callback();
|
|
2702
|
+
}
|
|
2703
|
+
}]);
|
|
2704
|
+
}(external_stream_namespaceObject.Transform);
|
|
2668
2705
|
;// CONCATENATED MODULE: ./src/public/node/UploadManagerNode.ts
|
|
2669
2706
|
function UploadManagerNode_typeof(o) { "@babel/helpers - typeof"; return UploadManagerNode_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, UploadManagerNode_typeof(o); }
|
|
2670
2707
|
function UploadManagerNode_empty() {}
|
|
@@ -2865,6 +2902,7 @@ function UploadManagerNode_setPrototypeOf(o, p) { UploadManagerNode_setPrototype
|
|
|
2865
2902
|
|
|
2866
2903
|
|
|
2867
2904
|
|
|
2905
|
+
|
|
2868
2906
|
var UploadManager = /*#__PURE__*/function (_UploadManagerBase) {
|
|
2869
2907
|
function UploadManager() {
|
|
2870
2908
|
UploadManagerNode_classCallCheck(this, UploadManager);
|
|
@@ -2969,20 +3007,12 @@ var UploadManager = /*#__PURE__*/function (_UploadManagerBase) {
|
|
|
2969
3007
|
value: function doPutUploadPart(part, contentLength, source, onProgress, addCancellationHandler) {
|
|
2970
3008
|
try {
|
|
2971
3009
|
var _this = this;
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
return UploadManagerNode_await(_this.sliceDataForRequest(source, part), function (stream) {
|
|
2976
|
-
var streamWithProgress = stream.on("data", function (data) {
|
|
2977
|
-
if (data.byteLength !== undefined) {
|
|
2978
|
-
bytesSent += data.byteLength;
|
|
2979
|
-
onProgress(bytesSent);
|
|
2980
|
-
} else if (!hasWarned) {
|
|
2981
|
-
hasWarned = true;
|
|
2982
|
-
console.warn("Expected stream to contain buffers, but it did not, so upload progress won't be reported.");
|
|
2983
|
-
}
|
|
3010
|
+
return UploadManagerNode_await(_this.sliceDataForRequest(source, part), function (inputStream) {
|
|
3011
|
+
var progressStream = new ProgressStream({
|
|
3012
|
+
onProgress: onProgress
|
|
2984
3013
|
});
|
|
2985
|
-
|
|
3014
|
+
inputStream.pipe(progressStream);
|
|
3015
|
+
return UploadManagerNode_await(UploadManagerFetchUtils.doPutUploadPart(_this.config, part, _this.coerceRequestBody(progressStream), contentLength, addCancellationHandler));
|
|
2986
3016
|
});
|
|
2987
3017
|
} catch (e) {
|
|
2988
3018
|
return Promise.reject(e);
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import type * as stream from "stream";
|
|
5
5
|
export declare class StreamUtils {
|
|
6
6
|
static create(): stream.Readable;
|
|
7
|
+
static endStream(readable: stream.Readable): void;
|
|
7
8
|
static empty(): NodeJS.ReadableStream;
|
|
8
|
-
static fromArrayBuffer(buffer: ArrayBuffer): NodeJS.ReadableStream;
|
|
9
9
|
static fromBuffer(buffer: Buffer): NodeJS.ReadableStream;
|
|
10
|
-
static
|
|
10
|
+
static fromArrayBuffer(buffer: ArrayBuffer): NodeJS.ReadableStream;
|
|
11
11
|
}
|
|
@@ -26,7 +26,7 @@ export declare abstract class UploadManagerBase<TSource, TInit> implements Uploa
|
|
|
26
26
|
};
|
|
27
27
|
protected abstract preUpload(source: TSource): TInit;
|
|
28
28
|
protected abstract postUpload(init: TInit): Promise<void>;
|
|
29
|
-
protected abstract doPutUploadPart(part: UploadPart, contentLength: number, source: TSource, onProgress: (
|
|
29
|
+
protected abstract doPutUploadPart(part: UploadPart, contentLength: number, source: TSource, onProgress: (totalBytesTransferred: number) => void, addCancellationHandler: AddCancellationHandler): Promise<PutUploadPartResult>;
|
|
30
30
|
private onIntervalTick;
|
|
31
31
|
private makeCancellationMethods;
|
|
32
32
|
/**
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Transform, TransformCallback, TransformOptions } from "stream";
|
|
4
|
+
interface ProgressStreamOptions extends TransformOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Optional callback to handle progress updates.
|
|
7
|
+
* @param totalBytesTransferred - The total number of bytes transferred so far.
|
|
8
|
+
*/
|
|
9
|
+
onProgress?: (totalBytesTransferred: number) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare class ProgressStream extends Transform {
|
|
12
|
+
private readonly onProgress;
|
|
13
|
+
private totalBytes;
|
|
14
|
+
constructor(options?: ProgressStreamOptions);
|
|
15
|
+
_transform(chunk: Buffer, _encoding: BufferEncoding, callback: TransformCallback): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -16,7 +16,7 @@ export declare class UploadManager extends UploadManagerBase<UploadSourceProcess
|
|
|
16
16
|
};
|
|
17
17
|
protected preUpload(source: UploadSourceProcessedNode): UploadManagerNodeInit;
|
|
18
18
|
protected postUpload(init: UploadManagerNodeInit): Promise<void>;
|
|
19
|
-
protected doPutUploadPart(part: UploadPart, contentLength: number, source: UploadSourceProcessedNode, onProgress: (
|
|
19
|
+
protected doPutUploadPart(part: UploadPart, contentLength: number, source: UploadSourceProcessedNode, onProgress: (totalBytesTransferred: number) => void, addCancellationHandler: AddCancellationHandler): Promise<{
|
|
20
20
|
etag: string | undefined;
|
|
21
21
|
status: number;
|
|
22
22
|
}>;
|