UNPKG

@backtrace/sourcemap-tools

Version:
31 lines 982 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ZipArchive = void 0; const tar_stream_1 = __importDefault(require("tar-stream")); const zlib_1 = __importDefault(require("zlib")); class ZipArchive { constructor(opts) { this._pack = tar_stream_1.default.pack(opts); this._gz = zlib_1.default.createGzip(); this._pack.pipe(this._gz); } get stream() { return this._gz; } append(name, sourceMap) { this._pack.entry({ name }, sourceMap); return this; } finalize() { this._pack.finalize(); return new Promise((resolve, reject) => { this._gz.on('finish', () => resolve(this)); this._gz.on('error', reject); }); } } exports.ZipArchive = ZipArchive; //# sourceMappingURL=ZipArchive.js.map