stream-replace
Returns a transform stream that outputs data with 'needle' replaced with 'replacer'.
Features
- Same API as
String.replace()
- Honors needles appearing on chunk boundaries.
streamReplace(regexp|substr, newSubStr|function)
- Returns a
Stream.Transform
instance, whose output has some or all matches of a pattern in the stream's input replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match. SeeString.prototype.replace()
.
Examples
// Repalce all occurrences of 'foo' in 'data.txt' with 'bar',// and output to stdout var fs = ;var replace = ; fs ;
// Create a server listening on port 3000 that// proxies www.example.com, and replaces// 'example' with 'zombocom', and 'domain' with 'web page' var replace = ;var http = ; http;
License
MIT