@futagoza/pump
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

A wrapper around stream.pipeline (based on pump) that:

  • returns a promise
  • accepts the use of promises, as well as normal functions
  • accepts a single item
  • only allows a function, promise or stream to be passed
const pump = require( "@futagoza/pump" );
const fs = require( "fs" );

const source = fs.promises.readFile( "./package.json", "utf8" );
const getVersion = data => JSON.parse( data ).version;
const dest = fs.createWriteStream( "./VERSION" );

pump( source, getVersion, dest )
    .then( () => console.log( "Done!" ) )
    .catch( err => console.error( err ) );

History license

@futagoza/pump is Copyright (c) 2018+ Futago-za Ryuu

Readme

Keywords

Package Sidebar

Install

npm i @futagoza/pump

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

6.18 kB

Total Files

5

Last publish

Collaborators

  • ryuu