p-transform
Promised out of order transform.
Last updated 2 years ago by mshima .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install p-transform 
SYNC missed versions from official npm registry.

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.

import PTransform, { transform, pipeline } from '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.

License

Apache-2.0

API

Classes

PTransform

Constants

pipeline

Promisified pipeline

Functions

transform(transform, logName)

Shortcut to create a PTransform with transform and logName.

passthrough(spy, logName)

Shortcut to create a passthrough PTransform with spy and logName.

filter(filter, logName)

Shortcut to create a filter PTransform with filter and logName.

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.name(name) ⇒ PTransform

Set log name.

Kind: instance method of PTransform Returns: PTransform - this

Param Type
name String

pTransform.flushQueue() ⇒

Wait for queue idle.

Kind: instance method of PTransform Returns: Promise<void>

pTransform.queuedTransform(chunk, encoding) ⇒

Queued transform operation.

Kind: instance method of PTransform Returns: Promise

Param Type
chunk Object
encoding String

pipeline

Promisified pipeline

Kind: global constant

transform(transform, logName)

Shortcut to create a PTransform with transform and logName.

Kind: global function

Param Type
transform function
logName String

passthrough(spy, logName)

Shortcut to create a passthrough PTransform with spy and logName.

Kind: global function

Param Type
spy function
logName String

filter(filter, logName)

Shortcut to create a filter PTransform with filter and logName.

Kind: global function

Param Type
filter function
logName String

Current Tags

  • 4.1.5                                ...           latest (a year ago)

22 Versions

  • 4.1.5                                ...           a year ago
  • 4.1.4                                ...           a year ago
  • 4.1.3                                ...           a year ago
  • 4.1.2                                ...           a year ago
  • 4.1.1                                ...           a year ago
  • 4.1.0                                ...           a year ago
  • 4.0.5                                ...           a year ago
  • 4.0.4                                ...           a year ago
  • 4.0.3                                ...           a year ago
  • 4.0.2                                ...           a year ago
  • 4.0.1                                ...           a year ago
  • 4.0.0                                ...           a year ago
  • 3.0.3                                ...           a year ago
  • 3.0.2                                ...           a year ago
  • 3.0.1                                ...           a year ago
  • 3.0.0                                ...           a year ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.3.0                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Total 15
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (8)

© 2010 - cnpmjs.org x YWFE | Home | YWFE