Understanding Buffered Data
Buffered data is made up of a series of octets in big-endian or little-endian format. That means they take up considerably less space than text data. Therefore, Node.js provides the Buffer module, which allows you to create, read, write, and manipulate binary data in a buffer structure. The Buffer module is global, so you do not need to use the require() function to access it.
Buffered data is stored in a structure similar to that of an array, but it is stored outside the normal V8 heap in raw memory allocations. Therefore, a buffer cannot be resized.
When converting buffers to and from strings, you need to specify the explicit encoding method to be used. Table 5.1 lists the various encoding methods supported.
Table ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access