调整脚本 同步处理文件

This commit is contained in:
范大德 2023-12-15 01:48:52 +08:00
parent e17c4d002c
commit d88b4a509d

View File

@ -12,14 +12,9 @@ var child_process = require("child_process");
* @param callback * @param callback
*/ */
function replaceContents(file, callback) { function replaceContents(file, callback) {
fs.readFile(file, 'utf8', function (err, data) { var data = fs.readFileSync(file, 'utf8');
if (err) throw err;
data = callback(data); data = callback(data);
fs.writeFile(file, data, 'utf8', writeErr => { fs.writeFileSync(file,data,'utf8');
if (err) throw err;
console.log(file, 'replace success.');
});
});
} }
/** /**