async.js 711 B

1234567891011121314151617
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.getLibzipPromise = exports.getLibzipSync = void 0;
  4. const tslib_1 = require("tslib");
  5. const libzipAsync_1 = tslib_1.__importDefault(require("./libzipAsync"));
  6. const makeInterface_1 = require("./makeInterface");
  7. let promise = null;
  8. function getLibzipSync() {
  9. throw new Error(`Cannot use getLibzipSync when using the async version of the libzip`);
  10. }
  11. exports.getLibzipSync = getLibzipSync;
  12. async function getLibzipPromise() {
  13. if (promise === null)
  14. promise = (0, libzipAsync_1.default)().then(libzip => (0, makeInterface_1.makeInterface)(libzip));
  15. return promise;
  16. }
  17. exports.getLibzipPromise = getLibzipPromise;