@microsoft/stream-collator
Advanced tools
Comparing version 3.0.89 to 3.0.90
# Change Log - @microsoft/stream-collator | ||
This log was last generated on Tue, 10 Sep 2019 20:38:33 GMT and should not be manually modified. | ||
This log was last generated on Tue, 10 Sep 2019 22:32:23 GMT and should not be manually modified. | ||
## 3.0.90 | ||
Tue, 10 Sep 2019 22:32:23 GMT | ||
### Patches | ||
- Update documentation | ||
## 3.0.89 | ||
@@ -6,0 +13,0 @@ Tue, 10 Sep 2019 20:38:33 GMT |
@@ -0,2 +1,14 @@ | ||
/** | ||
* This library enables a tool to display live console output from multiple asynchronous processes, | ||
* while ensuring that their output does not get jumbled together. | ||
* | ||
* @remarks | ||
* | ||
* For more info, please see the package {@link https://www.npmjs.com/package/@microsoft/stream-collator | ||
* | README}. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
/** | ||
@@ -3,0 +15,0 @@ * A static class which manages the output of multiple threads. |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.3.11" | ||
"packageVersion": "7.4.0" | ||
} | ||
] | ||
} |
@@ -0,2 +1,13 @@ | ||
/** | ||
* This library enables a tool to display live console output from multiple asynchronous processes, | ||
* while ensuring that their output does not get jumbled together. | ||
* | ||
* @remarks | ||
* | ||
* For more info, please see the package {@link https://www.npmjs.com/package/@microsoft/stream-collator | ||
* | README}. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
export { Interleaver, ITaskWriter } from './Interleaver'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -5,4 +5,15 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* This library enables a tool to display live console output from multiple asynchronous processes, | ||
* while ensuring that their output does not get jumbled together. | ||
* | ||
* @remarks | ||
* | ||
* For more info, please see the package {@link https://www.npmjs.com/package/@microsoft/stream-collator | ||
* | README}. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
var Interleaver_1 = require("./Interleaver"); | ||
exports.Interleaver = Interleaver_1.Interleaver; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@microsoft/stream-collator", | ||
"version": "3.0.89", | ||
"version": "3.0.90", | ||
"description": "Display intelligible realtime output from your asynchronous streams", | ||
@@ -20,3 +20,3 @@ "repository": { | ||
"devDependencies": { | ||
"@microsoft/rush-stack-compiler-3.4": "0.1.21", | ||
"@microsoft/rush-stack-compiler-3.4": "0.1.22", | ||
"@types/chai": "3.4.34", | ||
@@ -27,4 +27,4 @@ "@types/mocha": "5.2.5", | ||
"mocha": "^5.2.0", | ||
"@microsoft/node-library-build": "6.1.8" | ||
"@microsoft/node-library-build": "6.1.9" | ||
} | ||
} |
## stream-collator | ||
Oftentimes, when working with multiple parallel asynchronous processes, it is helpful to ensure that their | ||
outputs are not mixed together, as this can cause readability issues in the console or log. The | ||
**stream-collator** manages the output of these streams carefully, such that no two streams are writing | ||
at the same time. At any given time, one stream registered with the collator is the **active stream** | ||
which means that particular stream will be live streaming, while the others will wait for that stream | ||
to finish before their completion. | ||
This library enables a tool to display live console output from multiple asynchronous processes, | ||
while ensuring that their output does not get jumbled together. | ||
## How does it work? | ||
The **stream-collator** manages the output of these streams, ensuring that no two streams are writing to the console | ||
at the same time. At any given time, one stream registered with the collator is the **active stream**, which means | ||
that particular stream will be live streaming, while the others will wait for that stream to finish before their | ||
output is displayed. | ||
For example, if you have 3 streams (e.g. from using `child_process.spawn()`). | ||
@@ -18,15 +21,14 @@ | ||
If these streams are all being piped directly to stdout, you could end up with something like: | ||
If these streams are all being piped directly to stdout (without stream-collator), you could end up with jumbled | ||
output: | ||
`ABACCCBCCCCBBABBCBBABBBBBBCCAB` | ||
**Yikes!** | ||
Something like the following would be much more useful to users of your application: | ||
Most likely, something like the following would be much more useful to users of your application: | ||
`AAAAABBBBBBBBBBBBBBBCCCCCCCCCC` | ||
This is where the **stream-collator** comes in handy! | ||
This is where the **stream-collator** comes in! | ||
## Installation | ||
## Usage | ||
@@ -37,2 +39,3 @@ Install the stream-collator: | ||
Import the collator: | ||
@@ -48,4 +51,2 @@ | ||
## Usage | ||
A stream collator adheres to the [NodeJS Stream API](https://nodejs.org/api/stream.html), meaning that it effectively | ||
@@ -61,3 +62,3 @@ is special type of [ReadableStream](https://nodejs.org/api/stream.html#stream_class_stream_readable). This makes | ||
Now, instantiate a stream collator instance and register the streams with it: | ||
Next, instantiate a stream collator instance and register the streams with it: | ||
@@ -64,0 +65,0 @@ ```javascript |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
128799
3119
105