Loading topic
ArrayBuffer is, how it differs from a regular array, and why you can't read its bytes directly.2 min readArrayBuffer is a fixed block of bytes you cannot read or write directly. A typed array gives you that access. It is a view: an object that reads the buffer's bytes as numbers of 2 min readArrayBuffer and wrap it in a typed array view. It also assumes you understand the difference between integers and floating-point numbers in JavaScript. Each typed array constructor fixes two things: how many bytes one element takes up, and how2 min readArrayBuffer and a typed array over it, and that you know the byte size of each element type. Here you will place several views at different positions in one buffer and learn the rules the constructor enforces when you do.2 min readArrayBuffer, and that you know how integer types wrap values that are out of range. Typed arrays have most of the methods of regular arrays. Some behave differently, and a few are missing. The most important difference to learn is w2 min readArrayBuffer, how to put several typed array views over it, and how to read numbers in hexadecimal. In the previous chapter you saw two views share one buffer. Here you will see why the bytes those views expose can appear in an order you did not expect2 min readArrayBuffer, how typed array views work, and what little-endian and big-endian byte order mean.2 min readUint8Array and read its elements. It also assumes you know that JavaScript strings are sequences of UTF-16 code units. Binary formats and network protocols store text as bytes, so you need a reliable way to move between the two. Browsers, Node.2 min readasync/await, basic fetch, and how to wrap an ArrayBuffer in a Uint8Array (covered earlier). Real binary data usually comes from the network or from the user's disk, not from new ArrayBuffer(). This chapter shows the standard ways to turn those s2 min readDataView, how big-endian and little-endian byte order differ, and how TextDecoder turns bytes into a string. Here you combine those pieces to read a stream of records from raw bytes.2 min readBigInt: literals like 42n, and the fact that BigInt and Number cannot be mixed in arithmetic.2 min readArrayBuffer, put typed array views over it, and use byteOffset and length. Everything here is part of ES2024, so you need a current browser or Node.js 20 or later.2 min readArrayBuffer and wrap it in a typed array. It also assumes you have basic familiarity with Web Workers: new Worker(), postMessage, and onmessage. The previous chapter covered transfer() and detached buffers, which this chapter builds on.2 min readArrayBuffer and how postMessage transfers a buffer to a worker. It also assumes you have basic experience with Web Workers or Node's worker_threads.2 min read