README
whack
text formatter stream
whack allows you to cap text to a specific width, similar to fmt -w <len>
.
Installation
npm install whack
Usage
whack(options)
Create a Transform stream, where options
is an object that can contain:
limit
- limit to split text. Defaults to80
.separator
- A string to insert when separating text. Defaults to\n
.splitOnWord
- Only split after full words. Defaults totrue
.stripNewline
- Remove both\n
and\r
characters from the chunk before processing. Defaults tofalse
.
var whack = require("whack");
var fs = require("fs");
fs.createReadStream("README.md")
.pipe(whack({ limit: 80 })) // limits line size to 80 chars
.pipe(process.stdout);