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
TypeScript (98.06%)
JavaScript (1.94%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
26,707,808
Last Day
351
Last Week
351
Last Month
156,004
Last Year
2,739,065
63 Stars
62 Commits
4 Forks
6 Watching
1 Branches
3 Contributors
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
Publised On
18 Jul 2024
Cumulative downloads
Total Downloads
Last day
0%
351
Compared to previous day
Last week
-98.9%
351
Compared to previous week
Last month
-6.6%
156,004
Compared to previous month
Last year
-12.6%
2,739,065
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.