1.0.1 • Published 8 years ago
text-stream v1.0.1
text-stream
A abstraction layer for creating transform streams.
This is a great way to modify and filter text quickly.
Usage:
import ts from 'text-stream'
fs.createReadStream('textfile.txt')
.pipe(ts(chunk => chunk.toUpperCase()))
.pipe(process.stdout)
Another example:
import ts from 'text-stream'
let under25 = chunk => {
const lines = chunk.split('\n')
const under25 = lines.filter(line => line.length < 25)
return under25.join('\n')
}
fs.createReadStream('textfile.txt')
.pipe(ts(under25))
.pipe(process.stdout)