replServer.setupHistory(historyPath, callback)
historyPath
<string> 历史文件的路径callback
<Function> 当历史写入准备好或出错时调用err
<Error>repl
<repl.REPLServer>
初始化 REPL 实例的历史日志文件。 当执行 Node.js 二进制文件并使用命令行 REPL 时,默认情况下会初始化一个历史文件。 但是,以编程方式创建 REPL 时并非如此。 在以编程方式使用 REPL 实例时,使用此方法初始化历史日志文件。
historyPath
<string> the path to the history filecallback
<Function> called when history writes are ready or upon errorerr
<Error>repl
<repl.REPLServer>
Initializes a history log file for the REPL instance. When executing the Node.js binary and using the command-line REPL, a history file is initialized by default. However, this is not the case when creating a REPL programmatically. Use this method to initialize a history log file when working with REPL instances programmatically.