nutty-body
v0.0.1
Published
Capture text piped from stdin
Downloads
2
Readme
nutty-body
Capture text piped from stdin
Install
Install the package using NPM:
npm install --save nutty-body
Example
//Import nutty
var nutty = require('nutty');
var nutty_body = require('nutty-body');
//Set the CLI name
nutty.set('name', 'stdin');
//Set the CLI description
nutty.set('description', 'My test app');
//Set the CLI version
nutty.set('version', '1.0.0');
//Parse the body
nutty.use(nutty_body({ limit: 1024 }));
//Use a middleware
nutty.use(function(args, next)
{
//Display in console
console.log('Data from stdin: ');
console.log(args.body);
});
//Run the CLI
nutty.run();
API
var nutty_body = require('nutty-body');
nutty_body(opt)
Returns a middleware to be used with nutty.use
(see the nutty.use documentation). The options argument must be an object with the following settings:
limit
: anumber
with the maximum data size that can be piped fromstdin
. Default is1024
.
License
MIT LICENSE.