Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

p-transform

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-transform

Promised out of order transform.

  • 3.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
373K
decreased by-3.71%
Maintainers
1
Weekly downloads
 
Created
Source

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

ParamTypeDescription
[options]ObjectOptions object forwarded to Transform.
[options.logName]StringCustom name for logger.
[options.transform]functionTransform function.
[options.queueOptions]ObjectOptions forwarded to PQueue instance.

pTransform.name(name) ⇒ PTransform

Set log name.

Kind: instance method of PTransform Returns: PTransform - this

ParamType
nameString

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

ParamType
chunkObject
encodingString

pipeline

Promisified pipeline

Kind: global constant

transform(transform, logName)

Shortcut to create a PTransform with transform and logName.

Kind: global function

ParamType
transformfunction
logNameString

passthrough(spy, logName)

Shortcut to create a passthrough PTransform with spy and logName.

Kind: global function

ParamType
spyfunction
logNameString

filter(filter, logName)

Shortcut to create a filter PTransform with filter and logName.

Kind: global function

ParamType
filterfunction
logNameString

FAQs

Package last updated on 29 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc