replServer.setupHistory(historyPath, callback)


为 REPL 实例初始化历史记录日志文件。当执行 Node.js 可执行文件并使用命令行 REPL 时,会默认初始化历史文件。但是,当以编程方式创建 REPL 时,情况并非如此。在以编程方式使用 REPL 实例时,请使用此方法初始化历史记录日志文件。

【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.】