node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

pad-stdio

pad-stdio Build Status

Pad stdout and stderr

Especially useful with CLI tools when you don't directly control the output.

Install

$ npm install --save pad-stdio

Usage

var padStdio = require('pad-stdio');
 
padStdio.stdout('  ');      // start padding 
console.log('foo');
padStdio.stdout('    ');
console.log('bar');
padStdio.stdout();          // end padding 
console.log('baz');
 
/*
  foo
    bar
baz
*/

API

padStdio.stdout(pad)

Pads each line of process.stdout with the supplied pad string until the method is called again with no arguments.

padStdio.stderr(pad)

Pads each line of process.stderr with the supplied pad string until the method is called again with no arguments.

License

MIT © Sindre Sorhus