docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
Build a simple configuration file manager that stores and updates application settings in JSON format.
Create a module that provides functionality to:
Your implementation should handle edge cases such as invalid data and file write errors appropriately.
/**
* Saves configuration data to a file synchronously
* @param {string} filePath - Path where the configuration file should be saved
* @param {Object} config - Configuration object to save
* @throws {Error} If config is not an object or if file write fails
*/
function saveConfigSync(filePath, config) {}
/**
* Saves configuration data to a file asynchronously
* @param {string} filePath - Path where the configuration file should be saved
* @param {Object} config - Configuration object to save
* @param {Function} callback - Callback function (err)
*/
function saveConfigAsync(filePath, config, callback) {}
module.exports = { saveConfigSync, saveConfigAsync };Provides an in-memory filesystem implementation for writing and managing configuration files.