UNPKG

@jovian/type-tools

Version:

TypeTools is a Typescript library for providing extensible tooling runtime validations and type helpers.

37 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ZipUtil = void 0; try { zlib = require('zlib'); } catch (e) { } var ZipUtil; (function (ZipUtil) { ZipUtil.recentError = null; function zip(input) { return new Promise(function (resolve) { zlib.deflate(input, function (e, b) { if (e) { ZipUtil.recentError = e; return resolve(null); } resolve(b.toString('base64')); }); }); } ZipUtil.zip = zip; function unzip(input) { return new Promise(function (resolve) { var inputBuffer = Buffer.from(input, 'base64'); zlib.unzip(input, function (e, b) { if (e) { ZipUtil.recentError = e; return resolve(null); } resolve(b.toString('utf8')); }); }); } ZipUtil.unzip = unzip; })(ZipUtil = exports.ZipUtil || (exports.ZipUtil = {})); //# sourceMappingURL=zlib.js.map