-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Essential Cryptography for JavaScript Developers
By :

In Chapter 2, Dealing with Binary and Random Data, we saw how, in Node.js, binary data is typically stored in Buffer
objects and how those contain utilities to encode to, and decode from, strings too. Sadly, the Buffer
API is one that, to this day, remains specific to Node.js, while the Web Platform opted for a different (more flexible, but possibly more complex) approach.
In the JavaScript specifications supported by web browsers, binary data is stored inside buffers (which is not the same as Buffer
objects in Node.js!) and is accessed through views such as typed arrays.
The ArrayBuffer
object implements buffers as a chunk of fixed-length data. You can't access data inside an ArrayBuffer
object directly, and there are only a few methods and properties in this object that you need to know about:
ArrayBuffer
object with the new ArrayBuffer(length)
constructor, where...