fix: oshash exception

This commit is contained in:
monoid 2024-10-30 02:19:24 +09:00
parent 0d3128948b
commit 39d66e5280

View File

@ -20,6 +20,10 @@ export async function oshash(
let hash = BigInt(st.size);
if (st.size < minFileSize){
if (st.size < 8) {
fd.close();
throw new Error("Too short to hash");
}
// Although the original oshash algorithm should throw an exception,
// just applying the hash function.
const chunk = new Uint8Array(st.size);