You've already forked careful-downloader
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user