1
mirror of https://github.com/jakejarvis/careful-downloader.git synced 2026-01-14 06:42:56 -05:00

"simplify" the checksum file regex pattern

This commit is contained in:
2021-10-16 06:53:45 -04:00
parent 5d3410f47f
commit 1f7f290c90
2 changed files with 23 additions and 17 deletions

View File

@@ -64,7 +64,7 @@ const parseChecksumFile = async (checksumFile) => {
const data = fs.readFileSync(checksumFile, { encoding: "utf8" });
// https://regexr.com/67k7i
const lineRegex = /^([\da-fA-F]+) ([ *])(.+)$/;
const lineRegex = /^([\da-fA-F]+)[ \t]+[*]?(.+)$/;
// extract each file and its hash into this object
const checksums = {};
@@ -84,10 +84,8 @@ const parseChecksumFile = async (checksumFile) => {
} else {
parsedLine.shift();
// eslint-disable-next-line no-unused-vars
const [hash, binary, file] = parsedLine;
// save the current file & hash in the checksums object
const [hash, file] = parsedLine;
checksums[file] = hash;
}
}