Last active
December 11, 2015 16:49
-
-
Save katanacrimson/4630354 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var zlib = require('zlib') | |
zlib.gzip(Buffer('test'), function(err, res) { | |
console.dir(res) | |
var resString = res.toString() | |
var resBuffer = Buffer(resString, 'binary') | |
console.dir(resBuffer) | |
zlib.gunzip(resBuffer, function(err, text) { | |
if(err) throw err | |
console.log(text.toString()) | |
}) | |
}) | |
/* | |
$ node 4198.js | |
<Buffer 1f 8b 08 00 00 00 00 00 00 03 2b 49 2d 2e 01 00 0c 7e 7f d8 04 00 00 00> | |
<Buffer 1f fd 08 00 00 00 00 00 00 03 2b 49 2d 2e 01 00 0c 7e 7f fd 04 00 00 00> | |
Error: incorrect header check | |
at Zlib._binding.onerror (zlib.js:283:17) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment