Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fromFile = {}
}
var dirty = Object.keys(fromCL).some(function (key) { // Test if anything has changed
return fromFile[key] !== fromCL[key]
})
var config = Object.assign(defaultConfig, fromFile, fromCL) // Merge arguments and file parameters
if (!config.domain) {
console.log('No bucket was specified. Check your config file ' + path)
return
}
if (dirty && !config.lockConfig) { // Something has changed rewrite file, and we are allowed to write config file
fs.writeFile(fromCL.configFile, JSON.stringify(config, null, 3), function (err) {
if (err) console.error(err)
console.log('Updated config file: ' + fromCL.configFile)
cb(err, config)
})
} else { // No change, we're done
cb(err, config)
}
})
}
json['npm-shrinkwrap-version'] = version;
json['node-version'] = process.version;
json = fixResolved(json, null);
// if top level shrinkwrap has a `from` or `resolved`
// field then delete them
if (json.from) {
json.from = undefined;
}
if (json.resolved) {
json.resolved = undefined;
}
fs.writeFile(shrinkwrapFile,
JSON.stringify(json, null, 2) + '\n', callback);
}
function onRawMetaJson(err, rawJson) {
if (err) {
return callback(err);
}
var lines = rawJson.split('\n');
rawJson = lines.slice(0, lines.length - 2).join('\n');
fs.writeFile(metaPath, rawJson, 'utf8', callback);
}
};
function makeFile () {
fs.writeFile(file, '', function (err) {
if (err) return callback(err)
callback()
})
}
write: (file, overwrite, index, type, name, data, callback) => {
let directory = this.archive.path(file, index, type, name);
if (!this.archive.files[directory]) {
this.archive.createParentDir(directory);
this.archive.files[directory] = true;
}
if (overwrite) {
fs.writeFile(directory, data, 'utf8', callback);
} else {
fs.appendFile(directory, '\n' + data, 'utf8', callback);
}
},
read: (file, index, type, name, callback) => {
pathExists(dir, (err, itDoes) => {
if (err) return callback(err)
if (itDoes) return fs.writeFile(file, data, encoding, callback)
mkdir.mkdirs(dir, err => {
if (err) return callback(err)
fs.writeFile(file, data, encoding, callback)
})
})
}
ipcMain.on('DOWNLOAD_FILE', (event, args) => {
fs.writeFile(`${DOWNLOAD_PATH}/${args.filename}`, args.filedata, (error) => {
if (error) {
event.sender.send('FILE_DOWNLOAD_ERROR')
return
}
event.sender.send('FILE_DOWNLOAD_SUCCESS')
})
})
await new Promise((resolve, reject) => fs.writeFile(filePath, serializeJson(json, style), err => err ? reject(err) : resolve()));
}
+ "if [ -x "+shLongProg+" ]; then\n"
+ " " + shLongProg + " " + args + " " + shTarget + " \"$@\"\n"
+ " ret=$?\n"
+ "else \n"
+ " " + shProg + " " + args + " " + shTarget + " \"$@\"\n"
+ " ret=$?\n"
+ "fi\n"
+ "exit $ret\n"
} else {
sh = shProg + " " + args + " " + shTarget + " \"$@\"\n"
+ "exit $?\n"
}
var then = times(2, next, cb)
fs.writeFile(to + ".cmd", cmd, "utf8", then)
fs.writeFile(to, sh, "utf8", then)
function next () {
chmodShim(to, cb)
}
}
this.saveManifest = function (data, cb) {
this.manifest = data;
return fs.writeFile(path.join(this.paths.root, 'manifest.json'), serializeConfig(data), cb);
};