fix(hashFile): use path.basename to get file name (#2209)
Previously, the hashFile function was using file.name to get the file name, which resulted in undefined values in the output file. This commit fixes that by using path.basename(file.full) instead, which correctly extracts the file name from the full path.
This commit is contained in:
parent
1a529a9429
commit
20e40c2bad
1 changed files with 1 additions and 1 deletions
|
@ -24,7 +24,7 @@ export default (async function (out, archiveFiles) {
|
||||||
const filesToAnalyze = Array.from(new Set(archiveFiles.map(f => f.full))).sort();
|
const filesToAnalyze = Array.from(new Set(archiveFiles.map(f => f.full))).sort();
|
||||||
let s = "";
|
let s = "";
|
||||||
for (const file of filesToAnalyze) {
|
for (const file of filesToAnalyze) {
|
||||||
s += `${await hashFile(file)}\t${file.name}\n`;
|
s += `${await hashFile(file)}\t${path.basename(file.full)}\n`;
|
||||||
}
|
}
|
||||||
await fs.promises.writeFile(out, s);
|
await fs.promises.writeFile(out, s);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue