Skip to content

Instantly share code, notes, and snippets.

@joduplessis
Created September 11, 2017 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joduplessis/94de307a48e7f761b4409bad67a298eb to your computer and use it in GitHub Desktop.
Save joduplessis/94de307a48e7f761b4409bad67a298eb to your computer and use it in GitHub Desktop.
Node boilerplate/example for receiving input from the console in a recursive manner.
#! /usr/bin/env node
// Resume our input from the console
process.stdin.resume();
process.stdin.setEncoding('utf8');
// Receive some data
process.stdin.on('data', function (text) {
// Split the string arguments
const receivedInputArguments = text.replace(/\n$/, '').split(' ');
// Do any execution here
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment