!69 fix write async bug

Merge pull request !69 from 卡哥/write
This commit is contained in:
openharmony_ci 2022-06-21 02:03:46 +00:00 committed by Gitee
commit 1cbfc96d65
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -373,12 +373,7 @@ function copyFile(inputFile, outputFile) {
fs.existsSync(outputFile)) {
copyJsonFile(inputFile, outputFile);
} else if (!fs.existsSync(outputFile)){
const readStream = fs.createReadStream(inputFile);
const writeStream = fs.createWriteStream(outputFile);
readStream.pipe(writeStream);
readStream.on('close', function() {
writeStream.end();
});
fs.writeFileSync(outputFile, fs.readFileSync(inputFile, 'utf-8'));
}
} catch (err) {
throw err;