调整脚本 同步处理文件
This commit is contained in:
parent
e17c4d002c
commit
d88b4a509d
@ -12,14 +12,9 @@ var child_process = require("child_process");
|
||||
* @param callback
|
||||
*/
|
||||
function replaceContents(file, callback) {
|
||||
fs.readFile(file, 'utf8', function (err, data) {
|
||||
if (err) throw err;
|
||||
data = callback(data);
|
||||
fs.writeFile(file, data, 'utf8', writeErr => {
|
||||
if (err) throw err;
|
||||
console.log(file, 'replace success.');
|
||||
});
|
||||
});
|
||||
var data = fs.readFileSync(file, 'utf8');
|
||||
data = callback(data);
|
||||
fs.writeFileSync(file,data,'utf8');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user