Exact list of Node core modules

后端 未结 5 2055
一个人的身影
一个人的身影 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:39

    As of Node v9.3.0, you just do this:

    require("module").builtinModules
    [ 'async_hooks',
      'assert',
      'buffer',
      'child_process',
      'console',
      'constants',
      'crypto',
      'cluster',
      'dgram',
      'dns',
      'domain',
      'events',
      'fs',
      'http',
      'http2',
      '_http_agent',
      '_http_client',
      '_http_common',
      '_http_incoming',
      '_http_outgoing',
      '_http_server',
      'https',
      'inspector',
      'module',
      'net',
      'os',
      'path',
      'perf_hooks',
      'process',
      'punycode',
      'querystring',
      'readline',
      'repl',
      'stream',
      '_stream_readable',
      '_stream_writable',
      '_stream_duplex',
      '_stream_transform',
      '_stream_passthrough',
      '_stream_wrap',
      'string_decoder',
      'sys',
      'timers',
      'tls',
      '_tls_common',
      '_tls_legacy',
      '_tls_wrap',
      'tty',
      'url',
      'util',
      'v8',
      'vm',
      'zlib',
      'v8/tools/splaytree',
      'v8/tools/codemap',
      'v8/tools/consarray',
      'v8/tools/csvparser',
      'v8/tools/profile',
      'v8/tools/profile_view',
      'v8/tools/logreader',
      'v8/tools/tickprocessor',
      'v8/tools/SourceMap',
      'v8/tools/tickprocessor-driver',
      'node-inspect/lib/_inspect',
      'node-inspect/lib/internal/inspect_client',
      'node-inspect/lib/internal/inspect_repl' ]
    

    see https://nodejs.org/api/modules.html#modules_module_builtinmodules

提交回复
热议问题