Refactor Stream Hosts

This commit is contained in:
SukkaW
2023-11-01 16:44:42 +08:00
parent f96505c4da
commit f3a7fdfa17
8 changed files with 1093 additions and 561 deletions

View File

@@ -12,6 +12,9 @@ async function compareAndWriteFile(linesA, filePath) {
if (!fs.existsSync(filePath)) {
console.log(`${filePath} does not exists, writing...`);
isEqual = false;
} else if (linesA.length === 0) {
console.log(`Nothing to write to ${filePath}...`);
isEqual = false;
} else {
let index = 0;
@@ -19,6 +22,12 @@ async function compareAndWriteFile(linesA, filePath) {
const lineA = linesA[index];
index++;
if (lineA === undefined) {
// The file becomes smaller
isEqual = false;
break;
}
if (lineA[0] === '#' && lineB[0] === '#') {
continue;
}