1.0.0 • Published 12 years ago
whack v1.0.0
whack
text formatter stream
whack allows you to cap text to a specific width, similar to fmt -w <len>.
Installation
npm install whackUsage
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\nand\rcharacters 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);1.0.0
12 years ago