Package Exports
- p-transform
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (p-transform) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
p-transform
Promised out of order transform.
Usage
A Transform that uses objectMode and implements custom _write
and _flush
methods.
transform
implementation must be sync or return a promise. Callback is not supported.
Promisified pipeline
and transform
shortcut are provided for convenience.
const { PTransform, transform, pipeline } = require('p-transform');
await pipeline(
new PTransform({
transform: async file => file
}),
transform(async file => file);
)
Debug
Use DEBUG=p-transform:*
environment variable.
For custom debug name set logName
option at PTransform constructor or transform
argument.
PTransform
Kind: global class
new PTransform([options])
PTransform
Param | Type | Description |
---|---|---|
[options] | Object |
Options object forwarded to Transform. |
[options.logName] | String |
Custom name for logger. |
[options.transform] | function |
Transform function. |
[options.queueOptions] | Object |
Options forwarded to PQueue instance. |
pTransform.flushQueue() ⇒
Wait for queue idle.
Kind: instance method of PTransform
Returns: Promise
pTransform.queuedTransform(chunk, encoding) ⇒
Queued transform operation.
Kind: instance method of PTransform
Returns: Promise
Param | Type |
---|---|
chunk | Object |
encoding | String |
License
Apache-2.0