unzip.js 760 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.unzip = void 0;
  6. function _fsExtra() {
  7. const data = require("fs-extra");
  8. _fsExtra = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. const StreamZip = require('node-stream-zip');
  14. const unzip = async (source, destination) => {
  15. return new Promise((resolve, reject) => {
  16. const zip = new StreamZip({
  17. file: source,
  18. storeEntries: true
  19. });
  20. (0, _fsExtra().mkdirpSync)(destination);
  21. zip.on('ready', () => {
  22. zip.extract(null, destination, err => {
  23. zip.close();
  24. if (err) {
  25. return reject(err);
  26. }
  27. resolve();
  28. });
  29. });
  30. });
  31. };
  32. exports.unzip = unzip;
  33. //# sourceMappingURL=unzip.js.map