API Reference

nconf

Hierarchical configuration with multiple stores, including argv, env, and file sources.

Official Documentation ↗
CompatibilityThis documentation covers version v0.12. Check the official docs for the latest API surface.

Installation

npmnpm install nconf

Methods

nconf layers configuration stores with explicit precedence from argv down to defaults.

Key Features

  • Multiple stores with defined precedence
  • argv, env, and file sources
  • get with typed or defaulted values

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/indexzero/nconf@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:51:04.496Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

FAQ

What is the precedence order?
Stores are consulted in the order you add them, so argv beats env, which beats files, which beats defaults you set.
How do nested keys work?
Use the separator character (colon by default) in key paths such as server:port to reach nested values.
Can env values stay strings?
Yes. nconf returns strings from env; parse numbers explicitly or set a type when reading, avoiding silent string comparisons.