import { promisify } from "node:util";
import zlib, { constants } from "node:zlib";

//#region lib/util/compress.ts
const brotliCompress = promisify(zlib.brotliCompress);
const brotliDecompress = promisify(zlib.brotliDecompress);
async function compressToBase64(input) {
	return (await brotliCompress(input, { params: {
		[constants.BROTLI_PARAM_MODE]: constants.BROTLI_MODE_TEXT,
		[constants.BROTLI_PARAM_QUALITY]: 8
	} })).toString("base64");
}
async function decompressFromBase64(input) {
	return (await brotliDecompress(Buffer.from(input, "base64"))).toString("utf8");
}

//#endregion
export { compressToBase64, decompressFromBase64 };
//# sourceMappingURL=compress.js.map