Exact list of Node core modules

后端 未结 5 2066
一个人的身影
一个人的身影 2021-02-04 05:56

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

5条回答
  •  故里飘歌
    2021-02-04 06:17

    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.

提交回复
热议问题