@cjser/p-transform
v5.0.1-cjser.2
Published
Promised out of order transform.
Readme
p-transform
Promised out of order transform.
Usage
Builds a out-of-order Duplex using a p-queue parallel queue.
transform implementation must be sync or return a promise. Callback is not supported.
Promisified pipeline and transform shortcut are provided for convenience.
import { OutOfOrder, transform, pipeline, passthrough, filter } from 'p-transform';
await pipeline(
new OutOfOrder(
{ transform: async file => file },
{ concurrency: 7 },
).duplex(() => console.log('done')),
passthrough(async file => {}, () => console.log('done')),
filter(async file => true, () => console.log('done')),
transform(async file => file, () => console.log('done')),
)Debug
Use DEBUG=p-transform:* environment variable.
License
Apache-2.0
API
Classes
Constants
Functions
OutOfOrder
Kind: global class
new OutOfOrder(transform[, queueOptions])
OutOfOrder
| Param | Type | Description | | -------------- | --------------------- | ------------------------------------- | | [transform] | function | Transform. | | [queueOptions] | Object | Options forwarded to PQueue instance. |
outOfOrder.duplex(end) ⇒ Duplex
Build Duplex.
Kind: instance method of OutOfOrder Returns: Duplex
| Param | Type | | ----- | --------------------- | | end | function |
pipeline
Promisified pipeline
Kind: global constant
transform(transform, end)
Shortcut to create a OutOfOrder with transform and end callback.
Kind: global function
| Param | Type | | --------- | --------------------- | | transform | function | | end | function |
passthrough(spy, end)
Shortcut to create a passthrough OutOfOrder with spy and end callback.
Kind: global function
| Param | Type | | ----- | --------------------- | | spy | function | | end | function |
filter(filter, end)
Shortcut to create a filter OutOfOrder with filter and end callback.
Kind: global function
| Param | Type | | ------ | --------------------- | | filter | function | | end | function |
cjser
This package is a CommonJS-compatible build generated by cjser for projects that still need require() support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
Original repository: git://github.com/mshima/p-transform.git
