You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm testing this out in a Cloudflare Workers-like environment (Oxygen 🙂 ) and unfortunately Buffer isn't supported there. I receive the error:
Error: Buffer is not globally defined in this environment. Consider setting useTArray to true
at Object.format [as jpg] (/node_modules/jpeg-js/lib/decoder.js:1141:15)
The good news is, if I only work with jpgs, I can modify this line
So somehow I need the ability to pass that useTArray option to jpeg-js and thing seem to work from there. (For jpegs at least. I don't think they work for pngs, but I'm haven't looked into that, yet.)
The text was updated successfully, but these errors were encountered:
I think this should work now, for both JPEG (because of the useTArray trick) and PNG because it shims global Buffer with an import from "node:buffer". This should work on most edge runtimes now.
Hello, I'm testing this out in a Cloudflare Workers-like environment (Oxygen 🙂 ) and unfortunately
Buffer
isn't supported there. I receive the error:The good news is, if I only work with jpgs, I can modify this line
get-pixels/src/get-pixels.ts
Line 41 in 7b07485
to the following code
which bypasses using a
Buffer
and usesUint8Array
directly, which is supported in CFWorkers! Docs on that option https://github.com/jpeg-js/jpeg-js#decode-optionsSo somehow I need the ability to pass that
useTArray
option tojpeg-js
and thing seem to work from there. (For jpegs at least. I don't think they work for pngs, but I'm haven't looked into that, yet.)The text was updated successfully, but these errors were encountered: