continuous-streams
Advanced tools
Comparing version 1.0.0-beta.6 to 1.0.0-beta.7
{ | ||
"name": "continuous-streams", | ||
"version": "1.0.0-beta.6", | ||
"version": "1.0.0-beta.7", | ||
"description": "Special purpose Node streams", | ||
@@ -17,3 +17,5 @@ "main": "src/index.js", | ||
"keywords": [ | ||
"streams" | ||
"stream", | ||
"streams", | ||
"continuous" | ||
], | ||
@@ -20,0 +22,0 @@ "author": "Frank Thelen", |
@@ -37,9 +37,9 @@ # Continuous Streams | ||
reader.readData = async (count) => { | ||
// read `count` items from resource (can be empty []) | ||
// read `count` items from resource | ||
// if rejects, a `skip` event is emitted (unless `skipOnError` is `false`) | ||
return items; // array of data items | ||
return items; // resolve with array of data items (can be empty) | ||
}; | ||
const writer = new ContinuousWriter({ | ||
parallelOps: 10, // max. `writeData()` to fire off in parallel | ||
parallelOps: 10, // max number of `writeData()` to fire off in parallel | ||
}); | ||
@@ -64,3 +64,3 @@ writer.writeData = async (item) => { | ||
### `ContinuousReader` | ||
### Class `ContinuousReader` | ||
@@ -76,3 +76,3 @@ Extends `stream.Readable`. | ||
* `chunkSize` - Whenever the number of objects in the internal buffer is dropping below `chunkSize`, a new chunk of data is read from the underlying resource. Higher means fewer polling but less real-time. Default is `50`. | ||
* `skipOnError` - If `true` (default), a `skip` event is emitted when `readData()` rejects. If `false`, an `error` event is emitted when `readData()` rejects which stops the pipeline if it was started with `pipeline()`. Default is `true`. | ||
* `skipOnError` - If `true` (default), a `skip` event is emitted when `readData()` rejects. If `false`, an `error` event is emitted when `readData()` rejects which stops the pipeline when started with `pipeline()` (recommended). Default is `true`. | ||
* `waitAfterEmpty` - Delay in milliseconds if there is (temporarily) no data available. Default is `5000`. | ||
@@ -84,3 +84,3 @@ * `waitAfterLow` - Delay in milliseconds if there is (temporarily) less data available than chunk size. Default is `1000`. | ||
* `readData(count)` -- An async method to read `count` data items from the underlying resource. To be implemented or assigned. `count` is usually equals `chunkSize`. If it rejects, an `error` or `skip` event is emitted respectively (depending on `skipOnError`). | ||
* `readData(count)` -- An asynchronous method to read `count` data items from the underlying resource. To be implemented or assigned. `count` is usually equals `chunkSize`. It resolves with an array of data items -- which may be empty if there is temporarily no data available. If it rejects, an `error` or `skip` event is emitted (depending on `skipOnError`). | ||
* `stop()` - To be called after `SIGINT` or `SIGTERM` for gracefully shutting down the pipeline. The `end` event is emitted at the next reading attempt. Graceful shutdown means that all data that has been read so far will be fully processed throughout the entire pipeline. Example: `process.on('SIGINT', () => reader.stop())`. | ||
@@ -91,8 +91,8 @@ | ||
* `skip` - When reading from the underlying resource failed (if `skipOnError` is `true`). The stream continues to read after a delay of `waitAfterError`. Example handler: `reader.on('skip', ({ error }) => { ... })`. | ||
* `error` - When reading from the underlying resource failed (if `skipOnError` is `false`). If the pipeline was started with `pipeline()`, the pipeline will stop. If the pipeline was started with `pipe()`, it will continue processing -- an error handler must be provided though. Example handler: `reader.on('error', (error) => { ... })`. | ||
* `error` - When reading from the underlying resource failed (if `skipOnError` is `false`). If the pipeline was started with `pipeline()` (recommended), the pipeline will stop. If the pipeline was started with `pipe()`, it will continue processing -- an error handler must be provided though. Example handler: `reader.on('error', (error) => { ... })`. | ||
* `end` - When `stop()` was called for gracefully shutting down the pipeline. | ||
* `close` - When the stream is closed (as usual). | ||
* `debug` - After each successful reading attempt providing some debug information. Example handler: `reader.on('debug', ({ items, requested, total, elapsed }) => { ... })`. | ||
* `debug` - After each successful reading attempt providing some debug information. Example handler: `reader.on('debug', ({ items, requested, total, elapsed }) => { ... })`. `items` is the number of read data items. `requested` is the number of requested data items (normally equals `count`). `total` is an overall counter. `elapsed` is the number of milliseconds of `readData()` to resolve. | ||
### `ContinuousWriter` | ||
### Class `ContinuousWriter` | ||
@@ -108,3 +108,3 @@ Extends `stream.Writable`. | ||
* `parallelOps` - The number of asynchronous write operations to submit in parallel, e.g., API requests. Default is `10`. | ||
* `parallelOps` - The max number of asynchronous `writeData()` operations to fire off in parallel. Default is `10`. | ||
* `skipOnError` - If `true` (default), a `skip` event is emitted when `writeData()` rejects. If `false`, an `error` event is emitted when `writeData()` rejects which stops the pipeline. Default is `true`. | ||
@@ -115,3 +115,3 @@ * `timeoutMillis` - Timeout in milliseconds for `writeData()`. Default is `60000`. | ||
* `writeData(item)` -- An async method to write/process a single data item. To be implemented or assigned. If it rejects, an `error` or `skip` event is emitted respectively (depending on `skipOnError`). | ||
* `writeData(item)` -- An asynchronous method to process a single data item. To be implemented or assigned. If it rejects, an `error` or `skip` event is emitted (depending on `skipOnError`). | ||
@@ -124,5 +124,5 @@ **Events** | ||
* `close` - After `error` or `finish` (as usual). | ||
* `debug` - After each successful write operation providing some debug information. Example handler: `writer.on('debug', ({ inflight, total, elapsed }) => { ... })`. | ||
* `debug` - After each successful write operation providing some debug information. Example handler: `writer.on('debug', ({ inflight, total, elapsed }) => { ... })`. `inflight` is the number of asynchroneous `writeData()` operations currenly inflight. `total` is an overall counter. `elapsed` is the number of milliseconds of `writeData()` to resolve. | ||
### `ContinuousTransformer` | ||
### Class `ContinuousTransformer` | ||
@@ -137,4 +137,4 @@ Extends `stream.Transform`. | ||
* `parallelOps` - The number of asynchronous transform operations to submit in parallel, e.g., API requests. Default is `10`. | ||
* `skipOnError` - Default is `true`. | ||
* `parallelOps` - The max number of asynchronous `transformData()` operations to fire off in parallel. Default is `10`. | ||
* `skipOnError` - If `true` (default), a `skip` event is emitted when `transformData()` rejects. If `false`, an `error` event is emitted when `transformData()` rejects which stops the pipeline. Default is `true`. | ||
* `timeoutMillis` - Timeout in milliseconds for `transformData()`. Default is `60000`. | ||
@@ -144,3 +144,3 @@ | ||
* `transformData(item)` -- An async method to transform/process a single data item. Returns the transformed data item (or an array of items in order to split the item into multiple items). To be implemented or assigned. If it rejects, an `error` or `skip` event is emitted respectively (depending on `skipOnError`). | ||
* `transformData(item)` -- An asynchronous method to process a single data item. Resolves with the transformed data item (or an array of items for splitting the item into multiple items). To be implemented or assigned. If it rejects, an `error` or `skip` event is emitted (depending on `skipOnError`). | ||
@@ -152,2 +152,2 @@ **Events** | ||
* `close` - When the stream is closed (as usual). | ||
* `debug` - After each successful transform operation providing some debug information. Example handler: `transformer.on('debug', ({ inflight, total, elapsed }) => { ... })`. | ||
* `debug` - After each successful transform operation providing some debug information. Example handler: `transformer.on('debug', ({ inflight, total, elapsed }) => { ... })`. `inflight` is the number of asynchroneous `transformData()` operations currenly inflight. `total` is an overall counter. `elapsed` is the number of milliseconds of `transformData()` to resolve. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
50636
0