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 CHANGED
@@ -1 +1 @@
1
- 1.0.282
1
+ 1.0.283
@@ -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 = 20;
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
- concurrentUploads.push(_Api.default.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer));
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 = 22;
975
+ _context15.next = 28;
965
976
  break;
966
- case 20:
977
+ case 26:
967
978
  chunks.push(chunkBuffer);
968
979
  length += chunk.length;
969
- case 22:
970
- _context15.next = 27;
980
+ case 28:
981
+ _context15.next = 33;
971
982
  break;
972
- case 24:
973
- _context15.prev = 24;
983
+ case 30:
984
+ _context15.prev = 30;
974
985
  _context15.t0 = _context15["catch"](0);
975
986
  reject(_context15.t0);
976
- case 27:
987
+ case 33:
977
988
  case "end":
978
989
  return _context15.stop();
979
990
  }
980
- }, _callee15, null, [[0, 24]]);
991
+ }, _callee15, null, [[0, 30]]);
981
992
  }));
982
993
  return function (_x20) {
983
994
  return _ref18.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.282",
3
+ "version": "1.0.283",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
@@ -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
- concurrentUploads.push(Api.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer))
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