rhino-1_7r4-bindeprecated

Node.js binary wrapper for Rhino 1.7R4.

Usage no npm install needed!

<script type="module">
  import rhino17r4Bin from 'https://cdn.skypack.dev/rhino-1_7r4-bin';
</script>

README

rhino-1_7r4-bin

rhino-1_7r4-bin is a Node.js binary wrapper for Rhino 1.7R4. Other binaries are also available for Rhino 1.7R3 and 1.7R5.

Installation

$ npm install --save rhino-1_7r4-bin

Usage

var child_process = require('child_process');
var rhino = require('rhino-1_7r4-bin');

// Using `child_process.spawn`
var proc = child_process.spawn('java', ['-jar'].concat(rhino.path, 'file.js'));

proc.stdout.on('data', function (data) {
  console.log(data);
});

proc.stderr.on('data', function (data) {
  console.log(data);
});

proc.on('close', function (code) {
  console.log('Code ' + code);
});

// Using `child_process.execFile`
child_process.execFile(rhino.binPath, ['file.js'], function (err) {
  if (err) { throw err; }

  console.log('`file.js` ran!');
});

CLI

$ npm install --global rhino-1_7r4-bin
$ rhino1_7r4 -help
Usage: java org.mozilla.javascript.tools.shell.Main [options...] [files]
Valid options are:
    -?, -help          Displays help messages.
    -w                 Enable warnings.
    -version 100|110|120|130|140|150|160|170|180
                       Set a specific language version.
    -opt [-1|0-9]      Set optimization level.
    -f script-filename Execute script file, or "-" for interactive.
    -e script-source   Evaluate inline script.
    -modules [uri]     Add a single path or URL element to the CommonJS
                       module search path. (implies -require)
    -require           Enable CommonJS module support.
    -sandbox           Enable CommonJS sandbox mode. (implies -require)
    -debug             Generate debug code.
    -strict            Enable strict mode warnings.
    -fatal-warnings    Treat warnings as errors.
    -encoding charset  Use specified character encoding as default when reading
scripts.