Exact list of core Node modules

I am looking for a way to get an accurate updated list of all the core Node.js modules. Is there an NPM module that provides such a list? Somewhere in the annals of my life I had an answer to this question, but I do not remember it and I do not remember how good this decision was.

+8
source share
3 answers

If you do not mind accessing properties with a lower-level prefix, repl exports the _builtinLibs array:

 $ node -pe "require ('repl') ._ builtinLibs"
 ['assert',
   'buffer',
   'child_process',
   'cluster',
   'crypto',
   'dgram',
   'dns',
   'domain',
   'events',
   'fs',
   'http',
   'https',
   'net',
   'os',
   'path',
   'punycode',
   'querystring',
   'readline',
   'stream',
   'string_decoder',
   'tls',
   'tty',
   'url',
   'util',
   'v8',
   'vm',
   'zlib']

This list is not "complete" like the list provided by the builtin-modules module, as it does not include undocumented and similar modules.

+18
source share

J4F: you can use github api and get a list of files directly in JSON format.

 var http = require('https') var path = require('path') var options = { hostname: 'api.github.com', path: '/repos/nodejs/node/contents/lib', method: 'GET', headers: { 'Content-Type': 'application/json', 'user-agent': 'nodejs/node' } } var req = http.request(options, (res) => { res.setEncoding('utf8') var body = "" res.on('data', (data) => { body += data }) res.on('end', () => { var list = [] body = JSON.parse(body) body.forEach( (f) => { if (f.type === 'file' && f.name[0]!=='_' && f.name[0]!=='.') { list.push(path.basename(f.name,'.js')) } }) console.log(list) }) }) req.on('error', (e) => { throw (e) } ) req.end() 
+3
source share

33 modules are in the built-in modules according to https://www.npmjs.com/package/builtin-modules .

 36 according to core structures 28 repositories in Git 112 packages 

It takes a long time to compile this list. Doing this as a study on node_core would be a good option.

+2
source share

All Articles