A transform-stream for Node and browsers that efficeintly replaces sequences of bytes in a binary stream. Can be restricted to replace first n occurrences only.
varReplaceStream=require('binary-stream-replace');// replace first 10 occurrences of byte sequence `fe fe` with// `00 00 01`varrs=ReplaceStream(newBuffer([0xfe,0xfe]),newBuffer([0x00,0x00,0x01]),{maxOccurrences: 10});process.stdin.pipe(rs).pipe(process.stdout);