diff options
author | Alex Ramirez <alexander.ramirez@gmail.com> | 2019-06-08 08:16:21 -0500 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2019-07-20 11:29:58 +0200 |
commit | 44acec53862047b2b1e92d599525fd7b7986f73f (patch) | |
tree | 0a3f012aea25fb3de31038d5114c958b14f091bf | |
parent | 4a78fe5ab09be77ebab8e360cc04c957a88569f0 (diff) | |
download | android-node-v8-44acec53862047b2b1e92d599525fd7b7986f73f.tar.gz android-node-v8-44acec53862047b2b1e92d599525fd7b7986f73f.tar.bz2 android-node-v8-44acec53862047b2b1e92d599525fd7b7986f73f.zip |
doc: add example for zlib.createGzip()
PR-URL: https://github.com/nodejs/node/pull/28136
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r-- | doc/api/zlib.md | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/doc/api/zlib.md b/doc/api/zlib.md index 9850150708..08149db103 100644 --- a/doc/api/zlib.md +++ b/doc/api/zlib.md @@ -20,7 +20,14 @@ const fs = require('fs'); const inp = fs.createReadStream('input.txt'); const out = fs.createWriteStream('input.txt.gz'); -inp.pipe(gzip).pipe(out); +inp.pipe(gzip) + .on('error', () => { + // handle error + }) + .pipe(out) + .on('error', () => { + // handle error + }); ``` It is also possible to compress or decompress data in a single step: @@ -679,6 +686,7 @@ added: v0.5.8 * `options` {zlib options} Creates and returns a new [`Gzip`][] object. +See [example][zlib.createGzip example]. ## zlib.createInflate([options]) <!-- YAML @@ -1046,3 +1054,4 @@ Decompress a chunk of data with [`Unzip`][]. [RFC 7932]: https://www.rfc-editor.org/rfc/rfc7932.txt [pool size]: cli.html#cli_uv_threadpool_size_size [zlib documentation]: https://zlib.net/manual.html#Constants +[zlib.createGzip example]: #zlib_zlib |