Last change
on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
629 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | exports.merge = void 0;
|
---|
4 | const merge2 = require("merge2");
|
---|
5 | function merge(streams) {
|
---|
6 | const mergedStream = merge2(streams);
|
---|
7 | streams.forEach((stream) => {
|
---|
8 | stream.once('error', (error) => mergedStream.emit('error', error));
|
---|
9 | });
|
---|
10 | mergedStream.once('close', () => propagateCloseEventToSources(streams));
|
---|
11 | mergedStream.once('end', () => propagateCloseEventToSources(streams));
|
---|
12 | return mergedStream;
|
---|
13 | }
|
---|
14 | exports.merge = merge;
|
---|
15 | function propagateCloseEventToSources(streams) {
|
---|
16 | streams.forEach((stream) => stream.emit('close'));
|
---|
17 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.