@futagoza/pump
v1.0.0
Published
A wrapper around pump to use promises and normal functions.
Downloads
5
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 ) );
@futagoza/pump is Copyright (c) 2018+ Futago-za Ryuu