节点核心模块位置

Node core modules location

安装完nodejs后,我在哪里可以找到核心模块本身?我的 Linux 机器上它们的路径是什么?例如我想看看 fs 模块在哪里。

它们被编译成可执行文件,但它们的源可以是found here

编辑:我不是很熟悉 Node 的构建过程,但据我了解(主要来自 this) is that all files in the abovementioned directory are "converted" to C++ using tools/js2c.py,结果被写入中间文件node_javascript.cc 在构建过程中。

我假设它们挂接到 Node 的 module/bindings 系统的某个地方,这样当您使用 require('fs') 时,Node 将首先查看其内部模块列表。