files.com 1.0.282 → 1.0.283
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/lib/models/File.js +22 -11
- package/package.json +1 -1
- package/src/models/File.js +7 -1
package/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.283
|
package/lib/models/File.js
CHANGED
@@ -933,7 +933,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
933
933
|
});
|
934
934
|
readableStream.on('data', /*#__PURE__*/function () {
|
935
935
|
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(chunk) {
|
936
|
-
var nextLength, excessLength, chunkBuffer, tailLength, lastChunkForPart, firstChunkForNextPart, buffer, nextFileUploadPart;
|
936
|
+
var nextLength, excessLength, chunkBuffer, tailLength, lastChunkForPart, firstChunkForNextPart, buffer, nextFileUploadPart, uploadPromise;
|
937
937
|
return _regenerator.default.wrap(function _callee15$(_context15) {
|
938
938
|
while (1) switch (_context15.prev = _context15.next) {
|
939
939
|
case 0:
|
@@ -942,7 +942,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
942
942
|
excessLength = nextLength - firstFileUploadPart.partsize;
|
943
943
|
chunkBuffer = _safeBuffer.Buffer.from(chunk);
|
944
944
|
if (!(excessLength > 0)) {
|
945
|
-
_context15.next =
|
945
|
+
_context15.next = 26;
|
946
946
|
break;
|
947
947
|
}
|
948
948
|
readableStream.pause();
|
@@ -957,27 +957,38 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
957
957
|
return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
|
958
958
|
case 13:
|
959
959
|
nextFileUploadPart = _context15.sent;
|
960
|
-
|
960
|
+
uploadPromise = _Api.default.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer);
|
961
|
+
if (!firstFileUploadPart.parallel_parts) {
|
962
|
+
_context15.next = 19;
|
963
|
+
break;
|
964
|
+
}
|
965
|
+
concurrentUploads.push(uploadPromise);
|
966
|
+
_context15.next = 21;
|
967
|
+
break;
|
968
|
+
case 19:
|
969
|
+
_context15.next = 21;
|
970
|
+
return uploadPromise;
|
971
|
+
case 21:
|
961
972
|
chunks = [firstChunkForNextPart];
|
962
973
|
length = firstChunkForNextPart.length;
|
963
974
|
readableStream.resume();
|
964
|
-
_context15.next =
|
975
|
+
_context15.next = 28;
|
965
976
|
break;
|
966
|
-
case
|
977
|
+
case 26:
|
967
978
|
chunks.push(chunkBuffer);
|
968
979
|
length += chunk.length;
|
969
|
-
case
|
970
|
-
_context15.next =
|
980
|
+
case 28:
|
981
|
+
_context15.next = 33;
|
971
982
|
break;
|
972
|
-
case
|
973
|
-
_context15.prev =
|
983
|
+
case 30:
|
984
|
+
_context15.prev = 30;
|
974
985
|
_context15.t0 = _context15["catch"](0);
|
975
986
|
reject(_context15.t0);
|
976
|
-
case
|
987
|
+
case 33:
|
977
988
|
case "end":
|
978
989
|
return _context15.stop();
|
979
990
|
}
|
980
|
-
}, _callee15, null, [[0,
|
991
|
+
}, _callee15, null, [[0, 30]]);
|
981
992
|
}));
|
982
993
|
return function (_x20) {
|
983
994
|
return _ref18.apply(this, arguments);
|
package/package.json
CHANGED
package/src/models/File.js
CHANGED
@@ -116,7 +116,13 @@ class File {
|
|
116
116
|
const buffer = Buffer.concat(chunks)
|
117
117
|
const nextFileUploadPart = await File._continueUpload(destinationPath, ++part, firstFileUploadPart, options)
|
118
118
|
|
119
|
-
|
119
|
+
const uploadPromise = Api.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer)
|
120
|
+
|
121
|
+
if (firstFileUploadPart.parallel_parts) {
|
122
|
+
concurrentUploads.push(uploadPromise)
|
123
|
+
} else {
|
124
|
+
await uploadPromise
|
125
|
+
}
|
120
126
|
|
121
127
|
chunks = [firstChunkForNextPart]
|
122
128
|
length = firstChunkForNextPart.length
|