INNER CODE UNIT · JavaScript
loadHistory
cyrus-and/chrome-remote-interface · bin/client.js:78
function loadHistory() {
// only if run from a terminal
if (!process.stdin.isTTY) {
return;
}
// attempt to open the history file
let fd;
try {
fd = fs.openSync(historyFile, 'r');
} catch (err) {
return; // no history file present
}
// populate the REPL history
fs.readFileSync(fd, 'utf8')
.split('\n')
.filter((entry) => {
return entry.trim();
})