Skip to content

Instantly share code, notes, and snippets.

@ryanwilliamquinn
Last active November 18, 2016 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanwilliamquinn/be52bb4f8c565c9a5b849f9a59dacb35 to your computer and use it in GitHub Desktop.
Save ryanwilliamquinn/be52bb4f8c565c9a5b849f9a59dacb35 to your computer and use it in GitHub Desktop.
const fs = require('fs')
// app.js has one line: console.log('this is app.js')
const appReadstream = fs.createReadStream('files/app.js')
// index.js has one line: console.log('this is index.js')
const indexReadstream = fs.createReadStream('files/index.js')
const out1 = fs.createWriteStream('files/outindexfirst.js')
const out2 = fs.createWriteStream('files/outappfirst.js')
indexReadstream.pipe(appReadstream.pipe(out1))
appReadstream.pipe(indexReadstream.pipe(out2))
/*
both of the out files are identical for me, and look like this:
console.log('this is index.js')
console.log('this is app.js')
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment