Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exact list of Node core modules

Tags:

node.js

I am looking for a way to get an exact up-to-date list of all Node.js core modules. Is there an NPM module that supplies such a running list? Somewhere in the annals of my life I had an answer to this question written down, but I don't remember it nor do I remember how good a solution it was.

like image 794
Alexander Mills Avatar asked Mar 06 '16 07:03

Alexander Mills


People also ask

How many types of node modules are there?

Node.js has two module systems: CommonJS modules and ECMAScript modules.

Where can I find node modules?

On Unix systems they are normally placed in /usr/local/lib/node or /usr/local/lib/node_modules when installed globally. If you set the NODE_PATH environment variable to this path, the modules can be found by node. Non-global libraries are installed the node_modules sub folder in the folder you are currently in.

How many Nodejs packages are there?

Over 1.3 million packages are available in the main NPM registry.


1 Answers

If you don't mind accessing underscore-prefixed properties, repl exports a _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' ]

That list isn't as "complete" as the list provided by the builtin-modules module in that it does not include undocumented and similar modules.

like image 122
mscdex Avatar answered Oct 11 '22 22:10

mscdex