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

easy-transform-stream

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-transform-stream

Create a transform stream using await instead of callbacks

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
51K
increased by11.76%
Maintainers
1
Weekly downloads
 
Created
Source

easy-transform-stream

Create a transform stream using await instead of callbacks

The built-in stream.Transform constructor forces you to deal with a callback interface. It's much nicer to just be able to await and return a value.

This package can be thought of as a modern version of through2.

Install

npm install easy-transform-stream

Usage

import transformStream from 'easy-transform-stream';

const stream = transformStream(async chunk => {
	const newChunk = await modifyChunk(chunk);
	return newChunk;
});

API

easyTransformStream(transformer, flusher?)

easyTransformStream(options, transformer, flusher?)

transformer(chunk, encoding, stream)

Type: Async function

Receives each chunk and is expected to return a transformed chunk.

flusher(stream)

Type: Async generator function

Yield additional chunks at the end of the stream.

options

Type: object

Same as the options for stream.Transform, except for transform and flush.

  • get-stream - Get a stream as a string, buffer, or array

Keywords

FAQs

Package last updated on 31 Oct 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