访问核心 Node.js 模块
¥Accessing core Node.js modules
默认的求值器会在使用时自动将 Node.js 核心模块加载到 REPL 环境中。例如,除非另外声明为全局变量或作用域变量,否则输入 fs
将按需评估为 global.fs = require('node:fs')
。
¥The default evaluator will automatically load Node.js core modules into the
REPL environment when used. For instance, unless otherwise declared as a
global or scoped variable, the input fs
will be evaluated on-demand as
global.fs = require('node:fs')
.
> fs.createReadStream('./some/file');