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.

  • 5.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
384K
decreased by-6.83%
Maintainers
1
Weekly downloads
 
Created
Source

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

OutOfOrder

Constants

pipeline

Promisified pipeline

Functions

transform(transform, end)

Shortcut to create a OutOfOrder with transform and end callback

passthrough(spy, end)

Shortcut to create a passthrough OutOfOrder with spy and end callback

filter(filter, end)

Shortcut to create a filter OutOfOrder with filter and end callback

OutOfOrder

Kind: global class

new OutOfOrder(transform[, queueOptions])

OutOfOrder

ParamTypeDescription
[transform]functionTransform.
[queueOptions]ObjectOptions forwarded to PQueue instance.

outOfOrder.duplex(end) ⇒ Duplex

Build Duplex.

Kind: instance method of OutOfOrder Returns: Duplex

ParamType
endfunction

pipeline

Promisified pipeline

Kind: global constant

transform(transform, end)

Shortcut to create a OutOfOrder with transform and end callback.

Kind: global function

ParamType
transformfunction
endfunction

passthrough(spy, end)

Shortcut to create a passthrough OutOfOrder with spy and end callback.

Kind: global function

ParamType
spyfunction
endfunction

filter(filter, end)

Shortcut to create a filter OutOfOrder with filter and end callback.

Kind: global function

ParamType
filterfunction
endfunction

FAQs

Package last updated on 12 Oct 2024

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