1.0.4 • Published 9 years ago

stdin-transform-cli v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

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) })()