finki-main
main
|
Last change
on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | # decompress-response [](https://travis-ci.com/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, deflated or compressed with Brotli, otherwise just passes it through.
|
|---|
| 6 |
|
|---|
| 7 | Used by [`got`](https://github.com/sindresorhus/got).
|
|---|
| 8 |
|
|---|
| 9 | ## Install
|
|---|
| 10 |
|
|---|
| 11 | ```
|
|---|
| 12 | $ npm install decompress-response
|
|---|
| 13 | ```
|
|---|
| 14 |
|
|---|
| 15 | ## Usage
|
|---|
| 16 |
|
|---|
| 17 | ```js
|
|---|
| 18 | const http = require('http');
|
|---|
| 19 | const decompressResponse = require('decompress-response');
|
|---|
| 20 |
|
|---|
| 21 | http.get('https://sindresorhus.com', response => {
|
|---|
| 22 | response = decompressResponse(response);
|
|---|
| 23 | });
|
|---|
| 24 | ```
|
|---|
| 25 |
|
|---|
| 26 | ## API
|
|---|
| 27 |
|
|---|
| 28 | ### decompressResponse(response)
|
|---|
| 29 |
|
|---|
| 30 | Returns the decompressed HTTP response stream.
|
|---|
| 31 |
|
|---|
| 32 | #### response
|
|---|
| 33 |
|
|---|
| 34 | Type: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
|
|---|
| 35 |
|
|---|
| 36 | The HTTP incoming stream with compressed data.
|
|---|
| 37 |
|
|---|
| 38 | ---
|
|---|
| 39 |
|
|---|
| 40 | <div align="center">
|
|---|
| 41 | <b>
|
|---|
| 42 | <a href="https://tidelift.com/subscription/pkg/npm-decompress-response?utm_source=npm-decompress-response&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
|---|
| 43 | </b>
|
|---|
| 44 | <br>
|
|---|
| 45 | <sub>
|
|---|
| 46 | Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
|---|
| 47 | </sub>
|
|---|
| 48 | </div>
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.