Determines if the config file is read/write accessible. Returns true if the user has capabilities specified
by perm.
Optionalperm: number
The 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.
Optionalperm: number
The permission.
See https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_access_path_mode_callback
Removes all key/value pairs from the config object.
Returns an array of ConfigEntry for each element in the config.
Check to see if the config file exists. Returns true if the config file exists and has access, false otherwise.
Check to see if the config file exists. Returns true if the config file exists and has access, false otherwise.
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 (object property)
Optionaldecrypt: boolean
If it is an encrypted key, decrypt the value. If the value is an object, a clone will be returned.
Returns 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 list of keys that contain a value.
The value to filter keys on.
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.
Returns a boolean asserting whether a value has been associated to the key in the config object or not.
Returns true if this config is using the global path, false otherwise.
Returns an array that contains the keys for each element in the config object.
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.
OptionalthrowOnNotFound: boolean = false
Optionally indicate if a throw should occur on file read.
Optionalforce: boolean = false
Optionally force the file to be read from disk even when already read within the process.
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.
OptionalthrowOnNotFound: boolean = false
Optionally indicate if a throw should occur on file read.
Optionalforce: boolean = false
Optionally force the file to be read from disk even when already read within the process.
Convert an object to a ConfigContents and set it as the config contents.
The object.
Get the stats of the file. Returns the stats of the file.
fs.stat
Get the stats of the file. Returns the stats of the file.
fs.stat
Convert the config object to a JSON object. Returns the config contents. Same as calling ConfigStore.getContents
Delete the config file if it exists.
Throws Error{ name: 'TargetFileNotFound' } If the ConfigFile.getFilename file is not found.
fs.unlink
Delete the config file if it exists.
Throws Error{ name: 'TargetFileNotFound' } If the ConfigFile.getFilename file is not found.
fs.unlink
Returns true if an element in the config object existed and has been removed, or false if the element does not
exist. BaseConfigStore.has will return false afterwards.
The key
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
Returns an array that contains the values for each element in the config object.
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.
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.
StaticgetReturns the default options for the config file.
If the file should be stored globally or locally.
Optionalfilename: string
The name of the config file.
StaticgetReturns the config's filename.
StaticgetGets the config options for a given org ID.
The orgId. Generally this org would have multiple users configured.
StaticresolveHelper used to determine what the local and global folder point to. Returns the file path of the root folder.
True if the config should be global. False for local.
StaticresolveHelper used to determine what the local and global folder point to. Returns the file path of the root folder.
True if the config should be global. False for local.
A config file that stores usernames for an org.