What is builtins?
The 'builtins' npm package provides a list of Node.js built-in modules. It is useful for tools and libraries that need to know which modules are built into Node.js.
What are builtins's main functionalities?
List all built-in modules
This feature allows you to retrieve a list of all built-in modules in Node.js. The code sample demonstrates how to use the 'builtins' package to log the list of built-in modules to the console.
const builtins = require('builtins');
console.log(builtins());
List built-in modules for a specific Node.js version
This feature allows you to retrieve a list of built-in modules for a specific version of Node.js. The code sample demonstrates how to use the 'builtins' package to log the list of built-in modules for Node.js version 10.0.0 to the console.
const builtins = require('builtins');
console.log(builtins('10.0.0'));
Other packages similar to builtins
node-builtins
The 'node-builtins' package provides a list of Node.js built-in modules similar to 'builtins'. It is also used to identify built-in modules in Node.js, but it may have different methods or additional features.
builtin-modules
The 'builtin-modules' package offers a list of Node.js built-in modules. It is similar to 'builtins' but may have a different API or additional functionalities. It is often used in bundlers and other tools that need to handle Node.js built-ins.
builtins
List of node.js builtin modules.
Usage
const builtins = require('builtins')
Get list of core modules for current Node.js version:
assert(builtins().includes('http'))
Get list of core modules for specific Node.js version:
assert(builtins({ version: '6.0.0' }).includes('http'))
Get list of core modules present in one or mode Node.js versions:
assert(builtins({ version: '*' }).includes('worker_threads'))
Add experimental modules to the list:
assert(builtins({ experimental: true }).includes('wasi'))
License
MIT