Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fs.readFile(_path, function (err, data) {
if (err) return callback(err);
try {
data = properties.parse(data.toString(), {namespaces: true, variables: true, sections: true});
} catch (e) {
return callback(e);
}
// file has the highest priority
self._option = _.defaults(data, option, self._option);
log.info('the DisconfClient\'s option content: ' + JSON.stringify(self._option));
self._getZkInfo(callback);
});
} else {
return async.waterfall([(cb) => {
return properties.parse(configPath, {
path: true
}, cb);
}, (config, cb) => {
return utils.saveConfig(config, path.join(tempDir, 'test.config'), cb);
vault.extension (".properties", function (p, cb){
properties.parse (p, propertiesOptions, cb);
});
function readPropertiesFile(propertiesFile, jsonFile) {
properties.parse(propertiesFile, { path: true }, function (error, obj) {
var jsonString;
if (error) return console.error (error);
jsonString = JSON.stringify(obj, null, 1);
fs.writeFile(jsonFile, jsonString, function(err) {
if (err) {
return console.log(err);
}
console.log("Wrote file ", jsonFile);
});
});
}
function readPropertiesFile(propertiesFile, jsonFile) {
properties.parse(propertiesFile, { path: true }, function (error, obj) {
var jsonString;
if (error) return console.error (error);
jsonString = JSON.stringify(obj, null, 1);
fs.writeFileSync(jsonFile, jsonString);
});
}
fs.readFile(_path, function (err, data) {
if(err) return cb(err);
data = properties.parse(data.toString(), {namespaces: true, variables: true, sections: true});
option = option || {};
self._option = _.defaults(option, data, self._option);
info('The DisconfClient\'s option content: ' + JSON.stringify(option));
self.getZkInfo(cb);
});
}else{
const parse_messages = source => {
const messages_source = fs.readFileSync(source, { encoding: "utf-8" });
return properties.parse(messages_source, { namespaces: false });
};
function loadProperties(file, returnNullOnFail) {
try {
if (fs.statSync(file)) {
return properties.parse(grunt.file.read(file));
}
} catch (e) {
grunt.log.errorlns('Could not load properties file from ' + file);
grunt.verbose.errorlns(e);
if (returnNullOnFail) {
return null;
}
}
return {};
}
vault.extension (".properties", function (p, cb){
properties.parse (p, optionsProperties, cb)
});
.extension (".ini", function (file, cb){
properties.parse (file, {
path: true,
sections: true,
comments: ";",
separators: "=",
strict: true
}, cb);
})
.extension ([".yaml", ".yml"], function (file, cb){