1 |
|
2 | import { Readable, ReadableOptions } from 'stream';
|
3 |
|
4 |
|
5 |
|
6 | export interface SandwichOptions extends ReadableOptions {
|
7 | readonly head?: string | Buffer;
|
8 | readonly tail?: string | Buffer;
|
9 | readonly separator?: string | Buffer;
|
10 | }
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | export declare class SandwichStream extends Readable {
|
16 | private streamsActive;
|
17 | private streams;
|
18 | private newStreams;
|
19 | private head;
|
20 | private tail;
|
21 | private separator;
|
22 | private currentStream;
|
23 | |
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | constructor({ head, tail, separator, ...remaining }: SandwichOptions);
|
39 | /**
|
40 | * Add a new Readable stream in the queue
|
41 | *
|
42 | * @param newStream The Readable stream
|
43 | * @example
|
44 | * sandwichStream.add(streamOne);
|
45 | * sandwichStream.add(streamTwo);
|
46 | * sandwichStream.add(streamThree);
|
47 | * @throws An Error in case that this request was not accepted
|
48 | * @returns This instance of Sandwich Stream
|
49 | */
|
50 | add(newStream: Readable): this;
|
51 | /**
|
52 | * Works in a similar way from the Readable read, only that this one checks
|
53 | * for whether or not a stream is already being handled
|
54 | * @returns This instance of Sandwich Stream
|
55 | */
|
56 | _read(): void;
|
57 | /**
|
58 | * Binds an error thrown from one of the streams being handled
|
59 | *
|
60 | * @param err Error to be bind
|
61 | * @returns This instance of Sandwich Stream
|
62 | */
|
63 | private subStreamOnError;
|
64 | /**
|
65 | * Fetches the next stream to be handled
|
66 | * @returns This instance of Sandwich Stream
|
67 | */
|
68 | private streamNextStream;
|
69 | /**
|
70 | * Verifies whether or not the stream queue has ended
|
71 | * @returns This instance of Sandwich Stream
|
72 | */
|
73 | private nextStream;
|
74 | /**
|
75 | * Once the current stream starts to pass their data, this handles it in a
|
76 | * less complicated way
|
77 | * @returns This instance of Sandwich Stream
|
78 | */
|
79 | private bindCurrentStreamEvents;
|
80 | /**
|
81 | * Handles the data from a current stream once they are being streamed
|
82 | * @returns This instance of Sandwich Stream
|
83 | */
|
84 | private currentStreamOnReadable;
|
85 | /**
|
86 | * Handles the tagging once a stream is finished
|
87 | * @returns This instance of Sandwich Stream
|
88 | */
|
89 | private currentStreamOnEnd;
|
90 | /**
|
91 | * Adds the head tag to the Sandwich Stream
|
92 | * @returns This instance of Sandwich Stream
|
93 | */
|
94 | private pushHead;
|
95 | /**
|
96 | * Adds the separator tag to the Sandwich Stream
|
97 | * @returns This instance of Sandwich Stream
|
98 | */
|
99 | private pushSeparator;
|
100 | /**
|
101 | * Adds the tail tag to the Sandwich Stream
|
102 | * @returns This instance of Sandwich Stream
|
103 | */
|
104 | private pushTail;
|
105 | }
|
106 | export default SandwichStream;
|
107 | //# sourceMappingURL=sandwich-stream.d.ts.map |
\ | No newline at end of file |