Socket
Book a DemoInstallSign in
Socket

stdioify

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stdioify

Make any application that reads and writes files read and write from stdin/stdout instead.

0.2.2
latest
npmnpm
Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

stdioify Build Status

stdioify is a dirty little hack for making applications that read from and write to files use stdin/stdout instead.

Installation

npm install stdioify [-g]

Example

To make traceur read from stdin and output to stdout, run the following command

cat test.js | stdioify --command traceur --out-arg="--out" --suffix=".js"

stdioify will then read input data from stdin, write it out to a temporary file, set up a temporary file for output, and run the following command:

traceur --out <temp-out-file> <temp-in-file>

Finally, it will read the output file and write its data to stdout.

Use in code

stdioify can also be used as a library in node.js, of course.

var stdioify = require('./stdioify');

var js = 'class Greeter { sayHi() { console.log("Hi!"); } }\n' +
         'var greeter = new Greeter();\n' +
         'greeter.sayHi();';

stdioify({
    command:   'traceur',
    'out-arg': '--out',
    suffix:    '.js'
}).on('data', function(data) {
    console.log(data.toString());
}).write(js);

Options

  • --command, -c: Path to executable to run [required]
  • --in-arg, -i: Argument for in-file passed to command (if left out, filename will simply be appended to argument list)
  • --out-arg, -o: Argument for out-file passed to command (if left out, application is assumed to write to stdout already)
  • --suffix, -s: Suffix to use for temp files

Any arguments after -- will be passed to the application as-is.

License

WTFPL

Keywords

stdio

FAQs

Package last updated on 13 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.