Skip to content

Commit

Permalink
fix(megacloud): `WebAssembly.instantiate(): Argument 0 must be a buff…
Browse files Browse the repository at this point in the history
…er source` error
  • Loading branch information
ghoshRitesh12 committed Dec 19, 2024
1 parent e789b05 commit 277719e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/extractors/megacloud.getsrcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,14 @@ function Qj(QP: ArrayLike<number>, Qn: any) {
);
}

function isResponse(obj: Object) {
return Object.prototype.toString.call(obj) === "[object Response]";
}

async function QN(QP: Response, Qn: WebAssembly.Imports) {
let QT: ArrayBuffer, Qt: any;

return "function" == typeof Response && QP instanceof Response
return "function" == typeof Response && isResponse(QP)
? ((QT = await QP.arrayBuffer()),
(Qt = await WebAssembly.instantiate(QT, Qn)),
Object.assign(Qt, { bytes: QT }))
Expand Down

0 comments on commit 277719e

Please sign in to comment.