summaryrefslogtreecommitdiff
path: root/bin/wiki/ImportarDesdeURL/node_modules/clone-response/src/index.js
blob: 0285dfffe0c79040c8b709a615e3c6ef95962de6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';

const PassThrough = require('stream').PassThrough;
const mimicResponse = require('mimic-response');

const cloneResponse = response => {
	if (!(response && response.pipe)) {
		throw new TypeError('Parameter `response` must be a response stream.');
	}

	const clone = new PassThrough();
	mimicResponse(response, clone);

	return response.pipe(clone);
};

module.exports = cloneResponse;