@futagoza/pump

A wrapper around pump to use promises and normal functions.

Usage no npm install needed!

<script type="module">
  import futagozaPump from 'https://cdn.skypack.dev/@futagoza/pump';
</script>

README

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