Node.js Reference ยท process
Node.js process.features
Reference for process.features in Node.js: flags such as inspector, ipv6, tls, require_module and typescript that show which features this runtime supports.
process.features is an object of booleans (and a few getters) that tells you which optional capabilities the running Node.js build has. Examples are whether the inspector is compiled in, whether IPv6 and TLS are available, and whether require() can load ES modules or TypeScript files can be run directly.
Use it to adapt to the build you are on without catching errors from missing functionality.
console.log(process.features.ipv6, process.features.tls);
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.
Syntax
process.features: { inspector: boolean, debug: boolean, uv: boolean, ipv6: boolean, tls_alpn: boolean, tls_sni: boolean, tls_ocsp: boolean, tls: boolean, cached_builtins: boolean, require_module: boolean, typescript: false | 'strip' | 'transform', quic: boolean, openssl_is_boringssl: boolean }
| Property | Description |
|---|---|
inspector |
Whether the V8 inspector (debugger) support is built in. |
debug |
true for a debug build of Node. |
ipv6, uv |
IPv6 and libuv support; practically always true. |
tls, tls_alpn, tls_sni, tls_ocsp |
TLS and its extensions: tls is the umbrella flag for the others. |
cached_builtins |
Whether the built-in JavaScript modules were compiled into a cache. |
require_module |
Whether require() can load ES modules (synchronous graphs without top-level await). |
typescript |
false, or 'strip' / 'transform' when Node can run .ts files via type stripping or transformation. |
quic |
Whether the experimental QUIC support exists. |
Returns: an object; some entries are getters that evaluate when read. Which keys exist depends on the version.
Usage notes
- The older flags are stable.
inspector,ipv6,tlsanddebughave been there for many versions. The newer entries (require_module,typescript,quic) were added later; test for existence. - Missing key means unsupported, so write
if (process.features.typescript)rather than comparing with=== true. typescriptis not a type checker. Even when enabled, Node strips (or transforms) type syntax and runs the JavaScript; it does not check types. Usetscor the TypeScript compiler for that.- Reading it does not enable anything. Flags such as
--experimental-transform-typeschange the value, but writing toprocess.featureshas no effect. - Custom builds may disable TLS or the inspector (for example in minimal embedded builds); libraries that use
httpsshould handle that. - Good for conditional tests: skip tests that need
inspectorortlswhen the flag is false. - Not a version check. A feature can be present on a build for several versions; use
process.versionsonly when you need the actual number.