-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make file format compatible with Node's #6
Comments
just gave you the commit bit since I don't have time to maintain this project at the moment and you seem eager. |
For now the history is stored in a file named “.n_repl_history” in the user’s home directory. If some day in the future a sharable default emerges, this may be changed. References: tmpvar/repl.history#6 closes #16
I have had a look into how the node repl handles history. The file format is very similar to the format used by repl.history but the entries are stored in the opposite order. repl.history puts newest lines at the bottom of the file where as node puts newest lines first. The meaty code is: On line 211: function flushHistory() {
timer = null;
if (writing) {
pending = true;
return;
}
writing = true;
const historyData = repl.history.join(os.EOL);
fs.write(repl._historyHandle, historyData, 0, 'utf8', onwritten);
} Nothing any fancier than completely rewriting the file every time something happens. It wouldn't be too hard to do the same for repl.history I do think. |
repl.history's file format is not compatible with Node's history file format. nodejs/node#1513
After pointing NODE_REPL_HISTORY_FILE to my old history file I get the following error:
It would be nice to have one file format be used both from native repls and repls built on top of this module.
The text was updated successfully, but these errors were encountered: