zlib
zlib compresses data with gzip and deflate.
Example
const zlib = require("zlib");
const input = "hello ".repeat(100);
const zipped = zlib.gzipSync(input);
console.log(input.length, zipped.length < input.length);
console.log(zlib.gunzipSync(zipped).toString() === input);Result
600 true true
Exercise
Compress.
zlib.Sync(data)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.