.NODE 文件扩展名
Node.js Binary Addon File
| 开发者 | 不适用 |
| 受欢迎程度 |
3.6 | 10 票 |
什么是 NODE 文件?
A NODE file contains an addon, which is a compiled library of functions used by one or more Node.js applications. It stores binary data compiled from a GYP file written in the C++ programming language. NODE files are similar to .MJS modules in that they allow web and application developers to organize code into smaller reusable components.
更多信息
Web and app developers utilize NODE files to create addons for Node.js applications. These addons allow Node.js applications to link to libraries that provide functionality. A reusable addon project typically consists of a package.json file, a binding.gyp file, and C++ source code, whereas non-reusable modules don't need the package.json file.
To create NODE files, the developers first install the "node-gyp" utility bundled with Node.js using the following command:
npm install -g node-gyp
Then, the developers create binding.gyp files that describe the build configuration of the Node.js module. They then use the node-gyp configure command to create the proper build files and utilize the node-gyp build command to create the addon.node file.
注: To load an addon as a Node.js module, use the require() function.