moul
moul copied to clipboard
Minor wasm-vips improvements
Hi @thasophearak,
Thanks for using wasm-vips, I think you're the first to use it in combination with Cloudflare Workers!
I noticed your Tweet, and took a quick look at how wasm-vips was used. This PR improves a few things:
- Call
delete()
on every image instance that is returned from wasm-vips (see https://github.com/kleisauke/wasm-vips/issues/13#issuecomment-1073246828). - Avoid a
Uint8Array
copy; the resulting byte array is no longer backed by WebAssembly memory (see https://github.com/kleisauke/wasm-vips/commit/185bdc809a483b16d7851215978c08c356b2aca6).
BTW, were there any modifications needed to run this on Cloudflare Workers? I remembered that there was an execution time and a file size limit (see e.g. https://github.com/kleisauke/wasm-vips/issues/2), but perhaps that's no longer an issue.
@kleisauke Thanks a lot for the PR 🙇♂️ !
BTW, were there any modifications needed to run this on Cloudflare Workers?
Ahh, I should have mention it clearly, it's actually running on browser. Only after it's processed, then it is uploaded to R2, while image metadata store in KV.
The worker part is just running Moul as a whole. (Prev. moul is just a CLI self-contained binary)
Ah, I didn't see vips.wasm
being loaded in the network tab of my browser, so I assumed it was running in Cloudflare Workers. Thanks for the clarification.