reacting to user entered 's' but only for json file

This commit is contained in:
Gleb Bahmutov
2013-12-21 15:09:22 -05:00
parent bc36ab093e
commit 7017b829a6

View File

@ -13,6 +13,15 @@ function loadFile(file, cb) {
if (/\.js$/.test(file)) db = require(path).run(); if (/\.js$/.test(file)) db = require(path).run();
cb(db); cb(db);
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (userInput) {
console.log(userInput);
if (userInput.trim().toLowerCase() == 's') {
console.log('saving db');
}
});
} }
function loadURL(url, cb) { function loadURL(url, cb) {