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
:
If your transformation is an asynchronous function of the form module.exports = function(string, errorFirstCallback) { }
:
Otherwise, create your own bin script using the JavaScript API:
#!/usr/bin/env node { // Require and apply your transformation, then invoke }