# node-gzip

> Simply gzip and ungzip in Node.js with promises

Latest version **1.1.2** (published 2018-04-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-gzip
pnpm add node-gzip
yarn add node-gzip
bun add node-gzip
```

## Health

**Score 18/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2018-04-24 |
| First published | 2018-04-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/node-gzip) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 55 |
| Author | Rebsos |
| Maintainers | rebs |
| Keywords | node, gzip, compress, promise, gunzip, ungzip, decompress, uncompress, gz, zlib, async, await, promises |

## Links

- npm: https://www.npmjs.com/package/node-gzip
- Repository: https://github.com/Rebsos/node-gzip
- Homepage: https://github.com/Rebsos/node-gzip#readme
- Issues: https://github.com/Rebsos/node-gzip/issues
- npm.io page: https://npm.io/package/node-gzip

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 1.1.2 (latest) — 2018-04-24
- 1.1.1 — 2018-04-22
- 1.1.0 — 2018-04-22

## README

# node-gzip
> Gzip and ungzip in Node.js

Tiny and easy to use wrapper around [zlib.gzip](https://nodejs.org/api/zlib.html#zlib_zlib_gzip_buffer_options_callback) and [zlib.gunzip](https://nodejs.org/api/zlib.html#zlib_zlib_gunzip_buffer_options_callback) to support promises.

```js
const compressed = await gzip('Hello World');
```

## Install
```sh
npm install node-gzip --save
```



## Examples

#### With Promises

```js
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

```js
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](https://nodejs.org/api/zlib.html). See all [options](https://nodejs.org/api/zlib.html#zlib_class_options).

```js
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](./LICENSE).

---
_Source: https://npm.io/package/node-gzip · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
