Skip to content

starkwang/node-stream-replayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
})

About

Store a stream and replay it

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published