stdin-transform-cli
v1.0.4
Published
create a command-line interface for any string-to-string transformation
Downloads
15
Maintainers
Readme
Create a simple command-line interface for any string-to-string transformation.
$ npm install --save stdin-transform-cli
If your transformation is a synchronous function of the form module.exports = function(string) { }
, add the following to your package.json
:
{ "bin": "node_modules/stdin-transform-cli/sync" }
If your transformation is an asynchronous function of the form module.exports = function(string, errorFirstCallback) { }
:
{ "bin": "node_modules/stdin-transform-cli/async" }
Otherwise, create your own bin script using the JavaScript API:
#!/usr/bin/env node
require('stdin-transform-cli')(
require('./package/json'),
function(input, callback) {
// Require and apply your transformation, then invoke
callback(error, result) })()