版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1 год назад
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # decompress-response [![Build Status](https://travis-ci.org/sindresorhus/decompress-response.svg?branch=master)](https://travis-ci.org/sindresorhus/decompress-response)
  2. > Decompress a HTTP response if needed
  3. 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.
  4. Used by [`got`](https://github.com/sindresorhus/got).
  5. ## Install
  6. ```
  7. $ npm install decompress-response
  8. ```
  9. ## Usage
  10. ```js
  11. const http = require('http');
  12. const decompressResponse = require('decompress-response');
  13. http.get('https://sindresorhus.com', response => {
  14. response = decompressResponse(response);
  15. });
  16. ```
  17. ## API
  18. ### decompressResponse(response)
  19. Returns the decompressed HTTP response stream.
  20. #### response
  21. Type: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
  22. The HTTP incoming stream with compressed data.
  23. ---
  24. <div align="center">
  25. <b>
  26. <a href="https://tidelift.com/subscription/pkg/npm-unzip-response?utm_source=npm-unzip-response&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
  27. </b>
  28. <br>
  29. <sub>
  30. Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
  31. </sub>
  32. </div>