Closed chrisdickinson closed 2 months ago
curious if we can wrap these in the JS prelude to make the literal builtin atob
work
EDIT: just saw @bhelx track https://github.com/extism/js-pdk/issues/95
If its just the matter of providing a wrapper around these new Rust functions in JS, should we do it now?
If its just the matter of providing a wrapper around these new Rust functions in JS, should we do it now?
Ah, it's not – atob
and btoa
are legacy web platform APIs (added in the first version, I think!) They're pretty inefficient – in order to work with them you end up having to copy buffer data into or out of a string first (so you end up with 2 copies of the buffer + 1 copy of the encoded buffer.) They also don't work super well with Unicode, so it's tricky to roundtrip through the APIs. Most JS platforms add some method for encoding to and decoding from base64 as a result.
TIL! thank you
I think this is a reasonable approach. I'd like to go back eventually and add btoa support, etc. i'll add a ticket for it.