Gathering detailed insights and metrics for streamqueue
Gathering detailed insights and metrics for streamqueue
Gathering detailed insights and metrics for streamqueue
Gathering detailed insights and metrics for streamqueue
npm install streamqueue
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.3
Supply Chain
100
Quality
76.9
Maintenance
100
Vulnerability
100
License
TypeScript (98.06%)
JavaScript (1.94%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
63 Stars
62 Commits
4 Forks
5 Watchers
1 Branches
3 Contributors
Updated on Jul 29, 2024
Latest Version
2.0.0
Package Id
streamqueue@2.0.0
Unpacked Size
129.73 kB
Size
16.11 kB
File Count
13
NPM Version
10.7.0
Node Version
20.14.0
Published on
Jul 18, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
StreamQueue pipe the queued streams one by one in order to preserve their content order.
Install the npm module:
1npm install streamqueue --save
Then, in your scripts:
1import { StreamQueue } from 'streamqueue'; 2import { createReadStream } from 'node:fs'; 3 4const queue = new StreamQueue( 5 createReadStream('input.txt'), 6 createReadStream('input2.txt'), 7 createReadStream('input3.txt'), 8).pipe(process.stdout);
StreamQueue also accept functions returning streams, the above can be written like this, doing system calls only when piping:
1import { queueStreams } = require('streamqueue'); 2import { createReadStream } from 'node:fs'; 3 4const queue = queueStreams( 5 createReadStream.bind(null, 'input.txt'), 6 createReadStream.bind(null, 'input2.txt'), 7 createReadStream.bind(null, 'input3.txt'), 8).pipe(process.stdout);
Object-oriented traditionnal API offers more flexibility:
1import { StreamQueue } from 'streamqueue'; 2import { createReadStream } from 'node:fs'; 3 4const queue = new StreamQueue(); 5 6queue.queue( 7 createReadStream('input.txt'), 8 createReadStream('input2.txt'), 9 createReadStream('input3.txt'), 10); 11queue.done(); 12 13queue.pipe(process.stdout);
You can also chain StreamQueue methods like that:
1import StreamQueue from 'streamqueue'; 2import { createReadStream } from 'node:fs'; 3 4new StreamQueue() 5 .queue(createReadStream('input.txt')) 6 .queue(createReadStream('input2.txt')) 7 .queue(createReadStream('input3.txt')) 8 .done() 9 .pipe(process.stdout);
You can queue new streams at any moment until you call the done() method. So the created stream will not fire the end event until done() call.
Feel free to propose your code if you agree with publishing it under the MIT license.
Pipe queued streams sequentially
Create a new queue in object mode and pipe given streams and end if some
Create a new queue and pipe given streams and end if some
Pipe queued streams sequentially
Kind: global class
Create a new queue and pipe given streams and end if some
Returns: StreamQueue
Param | Type | Description |
---|---|---|
options | Object | The queue options |
options.objectMode | boolean | Operate in object mode |
options.pauseFlowingStream | boolean | Pause given streams that are flowing |
options.resumeFlowingStream | boolean | Resume given streams that are flowing |
...streams | Readable | function | The stream or stream returning function to pipe in |
Queue each stream given in argument
Kind: instance method of StreamQueue
Returns: StreamQueue
Param | Type | Description |
---|---|---|
...streams | Readable | function | The stream or stream returning function to pipe in |
Queue each stream given in argument and end
Kind: instance method of StreamQueue
Returns: StreamQueue
Param | Type | Description |
---|---|---|
...streams | Readable | function | The stream or stream returning function to pipe in |
Create a new queue in object mode and pipe given streams and end if some
Kind: global function
Returns: StreamQueue
Param | Type | Description |
---|---|---|
options | Object | The queue options |
...streams | Readable | function | The stream or stream returning function to pipe in |
Create a new queue and pipe given streams and end if some
Kind: global function
Returns: StreamQueue
Param | Type | Description |
---|---|---|
options | Object | The queue options |
...streams | Readable | function | The stream or stream returning function to pipe in |
No vulnerabilities found.
No security vulnerabilities found.