-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to unzip gzip response #747
Comments
I resolve it. |
How did you resolve it? |
@VRMink here it is example zlib = require('zlib');
function response (err, res, body) {
//check res header it is gzip
console.log(res.headers['content-encoding'])
//now body it is gzip stream buffer
zlib.unzip(body, function(err, buffer) {
console.log(buffer.toString())
}
}
request.get({
url : apiUrl,
headers: {
'Accept-Encoding' : 'gzip',
},
encoding : null // it is very import!!
}, response);
|
Thanks - that was not very obvious :) |
@youxiachai Thanks! |
Thanks for your solution! |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example:
The text was updated successfully, but these errors were encountered: