example.js 321 B

1234567891011121314
  1. 'use strict'
  2. var cloneable = require('./')
  3. var fs = require('fs')
  4. var pump = require('pump')
  5. var stream = cloneable(fs.createReadStream('./package.json'))
  6. pump(stream.clone(), fs.createWriteStream('./out1'))
  7. // simulate some asynchronicity
  8. setImmediate(function () {
  9. pump(stream, fs.createWriteStream('./out2'))
  10. })