builtins
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The 'builtins' package is a comprehensive list of Node.js builtin modules. It's primarily used to fetch this list by providing easy access to the details of core modules pertaining to either the current Node.js version being used, or to a specific Node.js version.
Utilizing builtins
in your JavaScript code is a straightforward process. To use builtins
, first you need to require it in your project by implementing the following line of code:
const builtins = require('builtins');
To fetch a list of the core modules in the Node.js version currently being used, you can use:
assert(builtins().includes('http'));
If you need to find core modules for a specific Node.js version, you can specify the version number. For example, to get the modules for version '6.0.0', write:
assert(builtins({ version: '6.0.0' }).includes('http'));
To access core modules present across multiple Node.js versions, use:
assert(builtins({ version: '*' }).includes('worker_threads'));
If you'd like to add experimental modules to your list, use the experimental
option like so:
assert(builtins({ experimental: true }).includes('wasi'));
As for documentation, builtins
doesn't seem to have a dedicated documentation page. However, considering its simplicity and the configuration options provided in the README file of the GitHub repository at git+https://github.com/juliangruber/builtins.git, the README file could be referred to as the main source of documentation.