text-stream

1.0.1 • Public • Published

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)

Package Sidebar

Install

npm i text-stream

Weekly Downloads

6

Version

1.0.1

License

MIT

Last publish

Collaborators

  • andruj