mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-13 01:30:37 +08:00
Fix: handle empty file compare and write properly
This commit is contained in:
parent
a02038704f
commit
d29ce74d52
@ -10,7 +10,7 @@ const { readFileByLine } = require('./fetch-remote-text-by-line');
|
||||
async function compareAndWriteFile(linesA, filePath) {
|
||||
await fse.ensureFile(filePath);
|
||||
|
||||
let isEqual = true;
|
||||
let isEqual = false;
|
||||
let index = 0;
|
||||
|
||||
for await (const lineB of readFileByLine(filePath)) {
|
||||
@ -23,6 +23,8 @@ async function compareAndWriteFile(linesA, filePath) {
|
||||
if (lineA !== lineB) {
|
||||
isEqual = false;
|
||||
break;
|
||||
} else {
|
||||
isEqual = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user