Determines if the config file is read/write accessible. Returns true
if the user has capabilities specified
by perm.
Optional
perm: numberThe permission.
See https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_access_path_mode_callback
Determines if the config file is read/write accessible. Returns true
if the user has capabilities specified
by perm.
Optional
perm: numberThe permission.
See https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_access_path_mode_callback
Asynchronously invokes actionFn
once for each key-value pair present in the config object.
The function (key: string, value: ConfigValue) => Promise<void>
to be called for
each element.
Returns an array of ConfigEntry for each element in the config.
Invokes actionFn
once for each key-value pair present in the config object.
The function (key: string, value: ConfigValue) => void
to be called for each element.
Returns the value associated to the key, or undefined if there is none.
The key. Supports query key like a.b[0]
.
Optional
decrypt: booleanIf it is an encrypted key, decrypt the value. If the value is an object, a clone will be returned.
Optional
decrypt: booleanReturns the entire config contents.
NOTE: Data will still be encrypted unless decrypt is passed in. A clone of the data will be returned to prevent storing un-encrypted data in memory and potentially saving to the file system.
Returns the absolute path to the config file.
The first time getPath is called, the path is resolved and becomes immutable. This allows implementers to override options properties, like filePath, on the init method for async creation. If that is required for creation, the config files can not be synchronously created.
Read the config file and set the config contents. Returns the config contents of the config file. As an
optimization, files are only read once per process and updated in memory and via write()
. To force
a read from the filesystem pass force=true
.
Throws SfError{ name: 'UnexpectedJsonFileFormat' } There was a problem reading or parsing the file.
Optional
throwOnNotFound: boolean = falseOptional
force: boolean = falseRead the config file and set the config contents. Returns the config contents of the config file. As an
optimization, files are only read once per process and updated in memory and via write()
. To force
a read from the filesystem pass force=true
.
Throws SfError{ name: 'UnexpectedJsonFileFormat' } There was a problem reading or parsing the file.
Optional
throwOnNotFound: boolean = falseOptional
force: boolean = falseSets the value for the key in the config object. This will override the existing value. To do a partial update, use BaseConfigStore.update.
The key. Supports query key like a.b[0]
.
The value.
Sets the entire config contents.
The contents.
Returns true
if all elements in the config object existed and have been removed, or false
if all the elements
do not exist (some may have been removed). BaseConfigStore.has(key) will return false afterwards.
The keys. Supports query keys like a.b[0]
.
Updates the value for the key in the config object. If the value is an object, it will be merged with the existing object.
The key. Supports query key like a.b[0]
.
The value.
Write the config file with new contents. If no new contents are provided it will write the existing config contents that were set from ConfigFile.read, or an empty file if ConfigFile.read was not called.
Optional
newContents: Contents<CachedOptions>The new contents of the file.
Write the config file with new contents. If no new contents are provided it will write the existing config contents that were set from ConfigFile.read, or an empty file if ConfigFile.read was not called.
Optional
newContents: Contents<CachedOptions>The new contents of the file.
Static
getStatic
getStatic
resolveStatic
resolveStatic
unset
A Time To Live configuration file where each entry is timestamped and removed once the TTL has expired.
Example