Skip to content

Instantly share code, notes, and snippets.

@motionharvest
Created February 12, 2014 22:50
Show Gist options
  • Save motionharvest/8966180 to your computer and use it in GitHub Desktop.
Save motionharvest/8966180 to your computer and use it in GitHub Desktop.
Internal Access to Node
/*
Give internal access via buffer
*/
var stdin = process.openStdin();
stdin.setEncoding( 'utf8' );
var abilities = {
reload: function (){
gulp.run('reload');
}
}
stdin.on( 'data', function( key ){
key = key.replace(/(\r\n|\n|\r)/gm,"");
if(abilities.hasOwnProperty(key)){
abilities[key]();
} else {
console.log("command not found. these are available:", abilities);
}
return;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment