fix: ensure axios returns binary data

This commit is contained in:
Derrick Hammer 2023-11-18 07:03:29 -05:00
parent f067a8583d
commit 518bbcdd94
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 1 deletions

View File

@ -224,10 +224,11 @@ export class S5Node {
try {
const res = await axios.get(dlUri.location.bytesUrl, {
timeout: 30000, // Adjust timeout as needed
responseType: "arraybuffer",
});
// Assuming rust.hashBlake3 and areBytesEqual are available functions
const resHash = blake3(res.data);
const resHash = blake3(Buffer.from(res.data));
if (!equalBytes(hash.hashBytes, resHash)) {
throw new Error("Integrity verification failed");