import module from "./lib/heic_wasm.js";

const { FS, callMain } = await module();

self.onmessage = (event) => {
    FS.writeFile("/input.heic", new Uint8Array(event.data.response));
    callMain(["/input.heic", "/output.jpg"]);
    const response = FS.readFile("/output.jpg");
    self.postMessage({ response }, [response.buffer]);
};

postMessage("READY");
