FileWithEmbeddedBlockMapDifferentialDownloader.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.FileWithEmbeddedBlockMapDifferentialDownloader = void 0;
  6. function _bluebirdLst() {
  7. const data = require("bluebird-lst");
  8. _bluebirdLst = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. function _blockMapApi() {
  14. const data = require("builder-util-runtime/out/blockMapApi");
  15. _blockMapApi = function () {
  16. return data;
  17. };
  18. return data;
  19. }
  20. function _DifferentialDownloader() {
  21. const data = require("./DifferentialDownloader");
  22. _DifferentialDownloader = function () {
  23. return data;
  24. };
  25. return data;
  26. }
  27. class FileWithEmbeddedBlockMapDifferentialDownloader extends _DifferentialDownloader().DifferentialDownloader {
  28. download() {
  29. var _this = this;
  30. return (0, _bluebirdLst().coroutine)(function* () {
  31. const packageInfo = _this.blockAwareFileInfo;
  32. const fileSize = packageInfo.size;
  33. const offset = fileSize - (packageInfo.blockMapSize + 4);
  34. _this.fileMetadataBuffer = yield _this.readRemoteBytes(offset, fileSize - 1);
  35. const newBlockMap = yield (0, _DifferentialDownloader().readBlockMap)(_this.fileMetadataBuffer.slice(0, _this.fileMetadataBuffer.length - 4));
  36. yield _this.doDownload(JSON.parse((yield (0, _blockMapApi().readEmbeddedBlockMapData)(_this.options.oldFile))), newBlockMap);
  37. })();
  38. }
  39. } exports.FileWithEmbeddedBlockMapDifferentialDownloader = FileWithEmbeddedBlockMapDifferentialDownloader;
  40. //# sourceMappingURL=FileWithEmbeddedBlockMapDifferentialDownloader.js.map