1 | # decompress-response [![Build Status](https://travis-ci.org/sindresorhus/decompress-response.svg?branch=master)](https://travis-ci.org/sindresorhus/decompress-response)
|
2 |
|
3 | > Decompress a HTTP response if needed
|
4 |
|
5 | Decompresses the [response](https://nodejs.org/api/http.html#http_class_http_incomingmessage) from [`http.request`](https://nodejs.org/api/http.html#http_http_request_options_callback) if it's gzipped or deflated, otherwise just passes it through.
|
6 |
|
7 | Used by [`got`](https://github.com/sindresorhus/got).
|
8 |
|
9 |
|
10 | ## Install
|
11 |
|
12 | ```
|
13 | $ npm install decompress-response
|
14 | ```
|
15 |
|
16 |
|
17 | ## Usage
|
18 |
|
19 | ```js
|
20 | const http = require('http');
|
21 | const decompressResponse = require('decompress-response');
|
22 |
|
23 | http.get('http://sindresorhus.com', response => {
|
24 | response = decompressResponse(response);
|
25 | });
|
26 | ```
|
27 |
|
28 |
|
29 | ## License
|
30 |
|
31 | MIT © [Sindre Sorhus](https://sindresorhus.com)
|