Open this example in the interactive library
Source code
import * as z from "node:zlib";
const data = Buffer.from("sample sample sample");
console.log(
(() => {
const dictionary = Buffer.from("sample");
return z
.inflateSync(z.deflateSync(data, { dictionary }), { dictionary })
.toString();
})(),
);
Sample output
sample sample sample
