0.1.0 • Published 4 years ago

stream-replayer v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

node-stream-replayer

Record a stream and replay it.

Install

npm install --save stream-replayer

Usage

const fs = require('fs')
const StreamReplayer = require('stream-replayer')

const replayer = new StreamReplayer()

// Pipe file A to file B and record the stream
fs.createReadStream('A')
  .pipe(replayer)
  .pipe(fs.createWriteStream('B'))

// Replay the stream to file C
replayer.play().pipe(fs.createWriteStream('C'))

options

maxBytes

The max bytes for replayer to record. Default: 10MB

const replayer = new StreamReplayer({
  maxBytes: 10 * 1024 // set max bytes to 10KB
})