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.52 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.51 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.50 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.49 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.48 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.47 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.46 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.45 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.44 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.43 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.42 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.41 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.40 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.39 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.38 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.32 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.31 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.30 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.29 node_modules/mimic-response/index.d.ts
immosquare-cleaner-0.1.28 node_modules/mimic-response/index.d.ts