Format cleanups
This commit is contained in:
parent
375360ed31
commit
c7cb20b43b
2 changed files with 14 additions and 12 deletions
|
@ -4,6 +4,17 @@ import crypto from "crypto";
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
export default async function (out, archiveFiles) {
|
||||
const filesToAnalyze = Array.from(new Set(archiveFiles.map(f => f.full))).sort();
|
||||
|
||||
let s = "";
|
||||
for (const filePath of filesToAnalyze) {
|
||||
s += `${await hashFile(filePath)}\t${path.basename(filePath)}\n`;
|
||||
}
|
||||
|
||||
await fs.promises.writeFile(out, s);
|
||||
}
|
||||
|
||||
function hashFile(filePath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let sum = crypto.createHash("sha256");
|
||||
|
@ -23,13 +34,3 @@ function hashFile(filePath) {
|
|||
});
|
||||
});
|
||||
}
|
||||
export default (async function (out, archiveFiles) {
|
||||
const filesToAnalyze = Array.from(new Set(archiveFiles.map(f => f.full))).sort();
|
||||
|
||||
let s = "";
|
||||
for (const filePath of filesToAnalyze) {
|
||||
s += `${await hashFile(filePath)}\t${path.basename(filePath)}\n`;
|
||||
}
|
||||
|
||||
await fs.promises.writeFile(out, s);
|
||||
});
|
||||
|
|
|
@ -6,7 +6,8 @@ const WebfontFormatMap = new Map([
|
|||
["WOFF2", "woff2"],
|
||||
["TTF", "truetype"]
|
||||
]);
|
||||
export default (function (output, family, hs, formats, unhinted) {
|
||||
|
||||
export default function (output, family, hs, formats, unhinted) {
|
||||
if (!formats) {
|
||||
fs.writeFileSync(output, "");
|
||||
return;
|
||||
|
@ -48,4 +49,4 @@ export default (function (output, family, hs, formats, unhinted) {
|
|||
}
|
||||
}
|
||||
fs.writeFileSync(output, ans);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue