json-config-read
v0.0.7
Published
Tool for easily reading JSON configuration folders
Downloads
1
Readme
json-config-read
install:
npm i --save json-config-read
API
Table of Contents
- ConfigReadOptions
- configReadSync
- configReadAsync
- configsListAsync
- configsListSync
- configsReadManyAsync
- configsReadManySync
ConfigReadOptions
Config read options type
Parameters
options
(Partial<ConfigReadOptions> | undefined | null) The options to merge, (optional, defaultnull
)
allowDirectories
True if directories can be read merging all files inside them
Type: boolean
rootPath
The root path to use. If unspecified, current directory is used.
Type: string
extensions
The file extensions that are parseable.
default
The default options.
Type: Partial<ConfigReadOptions>
configReadSync
Reads a configuration file or directory synchronously.
Parameters
configPath
string Path of the file or directory to loadoptions
Partial<ConfigReadOptions> The options (optional, defaultConfigReadOptions.default
)
Returns any The loaded data
configReadAsync
Reads a configuration file or directory asynchronously.
Parameters
configPath
string Path of the file or directory to loadoptions
Partial<ConfigReadOptions> The options (optional, defaultConfigReadOptions
)
Returns Promise<any> A promise that resolves the loaded data
configsListAsync
Lists all configurations in a directory, asynchrounously.
Parameters
folderPath
string Path of the folder that contains multiple configurations to listoptions
Partial<ConfigReadOptions> The options (optional, defaultConfigReadOptions
)
Returns Promise<Array<string>> A promise that resolves a list of full paths
configsListSync
Lists all configurations in a directory, synchrounously.
Parameters
folderPath
string Path of the folder that contains multiple configurations to listoptions
Partial<ConfigReadOptions> The options (optional, defaultConfigReadOptions
)
Returns Array<string> A list of all full paths of all configurations
configsReadManyAsync
Reads all the configurations contained in a folder to a map object
Parameters
folderPath
string Path of the folder that contains multiple configurations to loadoptions
Partial<ConfigReadOptions> The options (optional, defaultConfigReadOptions
)
Returns Promise<Object<string, any>> A promise that resolves a map of loaded configurations
configsReadManySync
Reads all the configurations contained in a folder to a map object
Parameters
folderPath
string Path of the folder that contains multiple configurations to loadoptions
Partial<ConfigReadOptions> The options (optional, defaultConfigReadOptions
)