Loading topic
&, |, >>). Here you will see how UTF-8 turns each Unicode code point into one to four bytes, 2 min readUint8Array, so you need a clear picture of how that container behaves.2 min readUint8Array is a view over raw bytes. The earlier chapters covered all three. Here you will turn strings into UTF-8 bytes with t2 min readUint8Array holds bytes, and how TextEncoder.encode produces them. TextDecoder does the reverse job. It reads bytes and gives you back a JavaScript string.2 min readUint8Array is and are comfortable with binary numbers and JavaScript's bitwise operators (<<, >>, &, |). It explains how base64 works. It does not cover the built-in browser functions for it, because the next chapter does.2 min readUint8Array. TextDecoder turns those bytes back into a string. And btoa throws InvalidCharacterError on any character above U+00FF. Here you combine these pieces so that any Unicode text can be 2 min read=. It also uses the bytesToBase64 and base64ToBytes helpers from the previous chapter, which encode text with TextEncoder and convert the resulting bytes to base64 through a binary string.2 min read= padding at the end. Browsers need the btoa workaround to do this, but Node2 min readbtoa/atob helpers from earlier chapters work. It covers the built-in methods that replace those helpers in newer runtimes.2 min readTextDecoder.decode turns a Uint8Array into a string, and that UTF-8 uses one to four bytes per code point. You should also be able to run async code in a browser console or Node.js 18 or later.2 min readTextEncoder turns strings into UTF-8 bytes.2 min readbtoa needs a binary string, what base64url is, and what Node's Buffer and the native Uint8Array base64 methods do. Here those pieces come together into one decision process and on2 min read