Linux v69820.1blu.de 4.15.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
Apache/2.4.58
Server IP : 195.90.215.149 & Your IP : 216.73.217.80
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
share /
doc /
node-mimic-response /
Delete
Unzip
Name
Size
Permission
Date
Action
changelog.Debian.gz
1.02
KB
-rw-r--r--
2022-06-01 12:18
copyright
1.88
KB
-rw-r--r--
2022-06-01 10:46
readme.md
1.89
KB
-rw-r--r--
2020-05-14 18:29
Save
Rename
# mimic-response [](https://travis-ci.com/sindresorhus/mimic-response) > Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) ## Install ``` $ npm install mimic-response ``` ## Usage ```js const stream = require('stream'); const mimicResponse = require('mimic-response'); const responseStream = getHttpResponseStream(); const myStream = new stream.PassThrough(); mimicResponse(responseStream, myStream); console.log(myStream.statusCode); //=> 200 ``` ## API ### mimicResponse(from, to) **Note #1:** The `from.destroy(error)` function is not proxied. You have to call it manually: ```js const stream = require('stream'); const mimicResponse = require('mimic-response'); const responseStream = getHttpResponseStream(); const myStream = new stream.PassThrough({ destroy(error, callback) { responseStream.destroy(); callback(error); } }); myStream.destroy(); ``` Please note that `myStream` and `responseStream` never throws. The error is passed to the request instead. #### from Type: `Stream` [Node.js HTTP response stream.](https://nodejs.org/api/http.html#http_class_http_incomingmessage) #### to Type: `Stream` Any stream. ## Related - [mimic-fn](https://github.com/sindresorhus/mimic-fn) - Make a function mimic another one - [clone-response](https://github.com/lukechilds/clone-response) - Clone a Node.js response stream --- <div align="center"> <b> <a href="https://tidelift.com/subscription/pkg/npm-mimic-response?utm_source=npm-mimic-response&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> </b> <br> <sub> Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. </sub> </div>