Socket
Socket
Sign inDemoInstall

node-gzip

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-gzip

Simply gzip and ungzip in Node.js with promises


Version published
Weekly downloads
125K
decreased by-23.32%
Maintainers
1
Install size
4.71 kB
Created
Weekly downloads
 

Readme

Source

node-gzip

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');

Install

npm install node-gzip --save

Examples

With Promises
const {gzip, ungzip} = require('node-gzip');

gzip('Hello World')
  .then((compressed) => {
    return ungzip(compressed);
  })
  .then((decompressed) => {
    console.log(decompressed.toString());     //Hello World
  });
With async / await
const {gzip, ungzip} = require('node-gzip');

const compressed = await gzip('Hello World');

const decompressed = await ungzip(compressed);

console.log(decompressed.toString());        //Hello World

Options

Pass options just like with Zlib. See all options.

await gzip('Hello World', {...});

Description

gzip(input[,options])
  • input: Buffer | TypedArray | DataView | ArrayBuffer | string
  • returns: Buffer
ungzip(input[,options])
  • input: Buffer | TypedArray | DataView | ArrayBuffer | string
  • returns: Buffer

Use toString() after ungzip to convert the Buffer into a string.

Supports Node.js version 0.12 and higher.


License

node-gzip is MIT licensed.

Keywords

FAQs

Last updated on 24 Apr 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc