Sha256: 5201edaef2835aa5d77f84c75732444a1c0594cc7e9d163af36c670195905bc1

Contents?: true

Size: 813 Bytes

Versions: 25

Compression:

Stored size: 813 Bytes

Contents

import {IncomingMessage} from 'node:http';

/**
Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage)

Makes `toStream` include the properties from `fromStream`.

@param fromStream - The stream to copy the properties from.
@param toStream - The stream to copy the properties to.
@return The same object as `toStream`.

@example
```
import {PassThrough as PassThroughStream} from 'node:stream';
import mimicResponse from 'mimic-response';

const responseStream = getHttpResponseStream();
const myStream = new PassThroughStream();

mimicResponse(responseStream, myStream);

console.log(myStream.statusCode);
//=> 200
```
*/
export default function mimicResponse<T extends NodeJS.ReadableStream>(
	fromStream: IncomingMessage,
	toStream: T,
): T & IncomingMessage;

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.27 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.26 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.25 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.24 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.23 node_modules/mimic-response/index.d.ts