tornado-repl

0.12.1 • Public • Published

deprecated

Simply use node's core readline module.

var fs = require('fs');
var readline = require('readline');
 
var file = fs.createWriteStream('output.log', 'utf8');
 
file.write('BEGIN\n');
 
var repl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  completer: function (line) {
    var hits = ['completion:'].concat((line || '').split(/\s+/));
    return [hits, line];
  }
}).on('line', function (line) {
  // do something with that line input
  file.write(line.trim() + '\n');
  repl.prompt();
}).on('SIGINT', function () {
  file.end('END');
  process.exit(0);
});
 
repl.prompt();

Package Sidebar

Install

npm i tornado-repl

Weekly Downloads

5

Version

0.12.1

License

MIT

Last publish

Collaborators

  • stringparser