1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.gunzipToString = exports.gzipString = exports.gunzipBuffer = exports.gzipBuffer = exports.inflateToString = exports.deflateString = exports.inflateBuffer = exports.deflateBuffer = void 0;
|
4 | const util_1 = require("util");
|
5 | const zlib = require("zlib");
|
6 | const deflate = (0, util_1.promisify)(zlib.deflate.bind(zlib));
|
7 | const inflate = (0, util_1.promisify)(zlib.inflate.bind(zlib));
|
8 | const gzip = (0, util_1.promisify)(zlib.gzip.bind(zlib));
|
9 | const gunzip = (0, util_1.promisify)(zlib.gunzip.bind(zlib));
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | async function deflateBuffer(buf, options = {}) {
|
16 | return await deflate(buf, options);
|
17 | }
|
18 | exports.deflateBuffer = deflateBuffer;
|
19 | async function inflateBuffer(buf, options = {}) {
|
20 | return await inflate(buf, options);
|
21 | }
|
22 | exports.inflateBuffer = inflateBuffer;
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | async function deflateString(s, options) {
|
28 | return await deflateBuffer(Buffer.from(s), options);
|
29 | }
|
30 | exports.deflateString = deflateString;
|
31 | async function inflateToString(buf, options) {
|
32 | return (await inflateBuffer(buf, options)).toString();
|
33 | }
|
34 | exports.inflateToString = inflateToString;
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | async function gzipBuffer(buf, options = {}) {
|
40 | return await gzip(buf, options);
|
41 | }
|
42 | exports.gzipBuffer = gzipBuffer;
|
43 | async function gunzipBuffer(buf, options = {}) {
|
44 | return await gunzip(buf, options);
|
45 | }
|
46 | exports.gunzipBuffer = gunzipBuffer;
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | async function gzipString(s, options) {
|
52 | return await gzipBuffer(Buffer.from(s), options);
|
53 | }
|
54 | exports.gzipString = gzipString;
|
55 | async function gunzipToString(buf, options) {
|
56 | return (await gunzipBuffer(buf, options)).toString();
|
57 | }
|
58 | exports.gunzipToString = gunzipToString;
|