provider option of the Configurate constructor. Each factory returns a frozen, branded ConfigurateProvider object; you cannot construct one by hand.
Providers at a glance
| Factory | Format | Encrypted | Human-readable |
|---|---|---|---|
JsonProvider() | JSON | No | Yes |
YmlProvider() | YAML | No | Yes |
TomlProvider() | TOML | No | Yes |
BinaryProvider() | Binary | Optional | No |
JsonProvider()
Creates a plain JSON storage provider. Config files are pretty-printed, making them easy to inspect in a text editor or version control system.A frozen provider object with
kind: "json".YmlProvider()
Creates a YAML storage provider. Config files are written as standard YAML, which supports comments and is widely used for human-authored configuration.A frozen provider object with
kind: "yml".TomlProvider()
Creates a TOML storage provider. Config files are written as TOML, which is favored for its strict specification and clear key-value syntax.A frozen provider object with
kind: "toml".BinaryProvider(opts?)
Creates a binary storage provider with optional XChaCha20-Poly1305 encryption. Without anencryptionKey, data is serialized to compact JSON bytes but not encrypted. With an encryptionKey, the bytes are encrypted before writing.
Encryption key passed to the key derivation function. Omit this option entirely to store data unencrypted (compact binary JSON). When provided, the file is XChaCha20-Poly1305-encrypted.
Key derivation function to apply to
encryptionKey before using it for encryption. Defaults to "sha256" when omitted."sha256"— Derives the key with a single SHA-256 hash. Fast and appropriate whenencryptionKeyis already a high-entropy random value (for example, a key retrieved from the OS keyring). Do not use this with a user-entered password."argon2"— Derives the key with Argon2id, using a per-file random salt stored in the file header. Use this whenencryptionKeyis a user-entered password or any low-entropy string.
A frozen provider object with
kind: "binary" and the supplied options.BinaryProvider files are not human-readable. If you need to inspect or migrate the data, use config.exportAs("json") to convert the current content to a readable format.