example.js 253 B

12345678910111213141516
  1. const tee = require('./')
  2. const { Readable } = require('streamx')
  3. const s = new Readable()
  4. for (let i = 0; i < 1000; i++) {
  5. s.push(Buffer.alloc(1024))
  6. }
  7. const [a, b] = tee(s)
  8. a.on('data', console.log)
  9. setTimeout(function () {
  10. b.read()
  11. }, 1000)