Closed ekkis closed 3 years ago
It's not included because I don't currently know of a high-quality polyfill, and if I did it would probably be too large to include by default when targeting a browser bundle. One thing i've wanted to add is a reexport of window.TextDecoder
and window.TextEncoder
in the browser if they are available, but i don't know if react native provides those.
Hi, is there any solution of this issue?
@shristov-iMeniu Node.js and browsers both provide these as global variables, so you can use those instead of importing the util package.
I think the above is a good solution. closing the issue. thank you
React-native doesn't provide any polyfill for TextEncoder, it would be great if util implemented it.
For those who want basic text-encoding (TextEncoder/TextDecoder), I made a fork that includes this. Based on text-encoding-polyfill as it is the most node-compatible (e.g. supports options such as fatal
). This lets you drop in support for libraries that rely on TextEncoder/TextDecoder from node's util
package.
Find it here: https://github.com/elliotsayes/node-util-text-encoding
I typically do:
but now I'm building a React Native app and had to actually install this package
npm i util
, however the methods above I see are missing. where can I get them from and why are they not included in this package?