I want to save the nodejs repl session to file. And from the file I can restore the status of that session, including user defined global variables and functions.
For example, if I type
a=1;b={x:1};b.__proto__={y:2};f=()=>{console.log(1)};
I want to save the session to a file and when restored the session from it, I can get a session with 3 global variables a,b,f, which have been properly set.
UPDATE 1
Different from node REPL's .save command and .load command, what I want is the current user defined global variables and functions properly Serialized and Deserialized.