/generator-transform-stream

Create a transform stream using an async generator

Primary LanguageJavaScriptMIT LicenseMIT

generator-transform-stream Build and Test

Create a transform stream using an async generator

Install

npm i -D generator-transform-stream

Usage

import fs from 'fs';
import { pipeline } from 'stream';
import gts from 'generator-transform-stream';

pipeline(
  fs.createReadStream('input.txt', 'utf8'),
  gts(async function* transform(input) {
    for await (const chunk of input) {
      yield chunk.toUpperCase();
    }
  }),
  fs.createWriteStream('output.txt')
);

Development

Run

npm start

Build

npm test

Publish

npm version patch|minor|major
git push --follow-tags