| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Gzip and ungzip in Node.js
Tiny and easy to use wrapper around zlib.gzip and zlib.gunzip to support promises.
const compressed = await gzip('Hello World');npm install node-gzip --saveconst {gzip, ungzip} = require('node-gzip');
gzip('Hello World')
.then((compressed) => {
return ungzip(compressed);
})
.then((decompressed) => {
console.log(decompressed.toString()); //Hello World
});const {gzip, ungzip} = require('node-gzip');
const compressed = await gzip('Hello World');
const decompressed = await ungzip(compressed);
console.log(decompressed.toString()); //Hello WorldPass options just like with Zlib. See all options.
await gzip('Hello World', {...});Use toString() after ungzip to convert the Buffer into a string.
Supports Node.js version 0.12 and higher.
node-gzip is MIT licensed.
| Back | FazBrowse Home | New Git URL |