Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TextEncoder, TextDecoder

See original GitHub issue

I typically do:

const {TextEncoder, TextDecoder} = require('util')

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?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

elliotsayescommented, Aug 8, 2022

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:

tex0lcommented, Jan 12, 2022

React-native doesn’t provide any polyfill for TextEncoder, it would be great if util implemented it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TextDecoder and TextEncoder - The Modern JavaScript Tutorial
The built-in TextDecoder object allows one to read the value into an actual JavaScript string, given the buffer and the encoding. We first...
Read more >
TextEncoder - Web APIs - MDN Web Docs
Chrome Edge TextEncoder Full support. Chrome38. Toggle history Full support. Edge79. To... TextEncoder() constructor Full support. Chrome38. Toggle history Full support. Edge79. To... encode Full support....
Read more >
JavaScript TextDecoder and TextEncoder - W3docs
In this chapter, we are going to explore TextEncoder and TextDecoder in JavaScript. Imagine that the binary data is a string. For example,...
Read more >
TextEncoder & TextDecoder | Can I use... Support ... - CanIUse
TextEncoder encodes a JavaScript string into bytes using the UTF-8 encoding and returns the resulting Uint8Array of those bytes. TextDecoder does the ...
Read more >
TextDecoder and TextEncoder in Javascript? - Tutorialspoint
TextEncoder is used to convert a given string to utf-8 standard. It retunes an Uint8Array from the string. TextDecoder is used to covert...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found