https://github.com/regular/binary-stream-replace
a transform-stream that efficiently replaces sequences of bytes in a binary stream, for Node and browsers.
https://github.com/regular/binary-stream-replace
Last synced: 9 months ago
JSON representation
a transform-stream that efficiently replaces sequences of bytes in a binary stream, for Node and browsers.
- Host: GitHub
- URL: https://github.com/regular/binary-stream-replace
- Owner: regular
- Created: 2015-01-27T16:06:00.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-06-03T09:11:18.000Z (almost 11 years ago)
- Last Synced: 2025-06-15T19:51:46.274Z (11 months ago)
- Language: JavaScript
- Size: 157 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
[](http://badge.fury.io/js/binary-stream-replace)
[](https://ci.testling.com/regular/binary-stream-replace)
binary-stream-replace
===
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.
Usage
---
``` js
var ReplaceStream = require('binary-stream-replace');
// replace first 10 occurrences of byte sequence `fe fe` with
// `00 00 01`
var rs = ReplaceStream(
new Buffer([0xfe, 0xfe]),
new Buffer([0x00, 0x00, 0x01]),
{ maxOccurrences: 10 }
);
process.stdin.pipe(rs).pipe(process.stdout);
```