Joins a given content to the content of a JSON file, or creates a new one if it doesn't exists.
The absolute path where the file is or will be located
The object to be merged or written to the JSON file
How much space to use for indentation when formatting
A promise that joins the content or creates the file when resolved
Merges the content of two JSON files into a third file, or duplicates one of the files if the other one is empty.
The absolute path of the first file
The absolute path of the second file
The absolute path where the file is or will be located
How much space to use for indentation when formatting
A promise that merges the files, or duplicates one of them, when resolved
Overwrites the content of an existing JSON file, or creates a new one if it doesn't exist.
The absolute path where the file is or will be located
The object to be written to the JSON file
How much space to use for indentation when formatting
A promise that overwrites or creates the file when resolved
Returns the content of a JSON file.
The absolute path where the file is located
A promise resolved with the content
Generated using TypeDoc
Contains functions for manipulating JSON files asynchronously using the File System module from NodeJS.
Only the main functions are exported. Functions not exported are abstractions of steps from the main functions.
Functions must be passed an absolute file path to behave as expected.
Functions that requires an optional intentation level parameter don't check its value. It's used by
JSON.stringify
and therefore, if the value is less than 1 no formatting is done, and if it's greater than 10, the indentation is just 10.When a function fails it returns a rejected Promise with:
Error
(actually is ofSystemError
, but Node doesn't exposes the class so it can't be checked using theinstanceof
operator) if it was caused by violating an operating system constraint, like: