Closed ThaUnknown closed 4 months ago
@mafintosh
b4a seems like a Buffer polyfill, I made uint8-util
which roughly does the same, just with a different API so it's a lot smaller, webtorrent
has been using it for quite a while now globally, pretty much since v2 it dropped buffer support :)
Thanks taking a look tmw. We use b4a everywhere so pretty happy with that
;-;
Where are you getting 20 kb from? text-decoder is <4kb
This needs a fallback to envs where TextDecoder doesnt exist, but honestly saving 4kb but adding the code that also supports the fallback doesn't seem worth the complexity to me
Ah let me re-review, i got confused by the comment, b4a is pulled in by textdecoder
Moved here https://github.com/holepunchto/text-decoder/pull/2
that is a private org
This needs a fallback to envs where TextDecoder doesnt exist
I personally struggled to find such envs, I think some very niche stuff like goja doesn't support it, and some smart TV's from 2010's, that's about it tho? I used streamx because of how tiny it was compared to stream, this change kinda nullifies that
Open now, was private by mistake
We use it on phones where its not there. Dont think 1kb matters personally.
We use it on phones where its not there. Dont think 1kb matters personally.
ah that makes sense.
yeah, I still don't like the fact that I'm importing packages and functionality which I won't be using, would be nice if this was in a separate class that extended readable/writable, rather than the main one so at least its tree-shakeable, or so I'd like to say, but I'm not sure if CJS would allow that
uses W3C text decoder which is built in to most JS environments such as node.js, web, bun etc
reduces dependency size by some 20-ish KB