Format cleanups

This commit is contained in:
be5invis 2024-03-03 22:55:18 -08:00
parent 375360ed31
commit c7cb20b43b
2 changed files with 14 additions and 12 deletions

View file

@ -4,6 +4,17 @@ import crypto from "crypto";
import fs from "fs"; import fs from "fs";
import path from "path"; 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) { function hashFile(filePath) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let sum = crypto.createHash("sha256"); 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);
});

View file

@ -6,7 +6,8 @@ const WebfontFormatMap = new Map([
["WOFF2", "woff2"], ["WOFF2", "woff2"],
["TTF", "truetype"] ["TTF", "truetype"]
]); ]);
export default (function (output, family, hs, formats, unhinted) {
export default function (output, family, hs, formats, unhinted) {
if (!formats) { if (!formats) {
fs.writeFileSync(output, ""); fs.writeFileSync(output, "");
return; return;
@ -48,4 +49,4 @@ export default (function (output, family, hs, formats, unhinted) {
} }
} }
fs.writeFileSync(output, ans); fs.writeFileSync(output, ans);
}); }