DjDeveloperr/deno-canvas

Doesn't work unless canvaskit.wasm is a local file

mjrlowe opened this issue · 2 comments

Nice work on this module! I had a go at using it but I quickly realised that you need to have the canvaskit.wasm file available locally (in the same directory as Canvas.MakeCanvas is called from), which is a little inconvenient.

I think this is unintentional--when you call Deno.readFileSync('./canvaskit.wasm') in lib.js, it reads the file relative to the user call, rather than the module.

Yup, I'll make it download the wasm file when its imported if that's not locally present. I'll be doing this in a bit.
I was testing with it being in my project directory, so didn't notice 😅

Edit: Now it would attempt to download (& save) if not locally present.

Seems to work now, thanks.

Once Deno gets wasm imports (which probably won't be for a while) we should be able to do this without needing --allow-read or --allow-net to read the wasm file.