Readings: Class04: Buffers - mwilkin-401-advanced-javascript/bend-javascript-401d2 GitHub Wiki
Buffers are a global class which is a part of the Node.js API for handling binary data. This is important because computers are able to represent every aspect of information, e.g. text, images, sound files, etc. as binary data or 1s and 0s. In fact, computers convert data into and out of their binary representations for operations such as storing and retrieving data. What is binary data? Collections of 1s and 0s which represent the data in a manner that the computer can manipulate and transfer quickly and easily. Binary data is based on a base-2 numeral system where 1 byte is 8 bits. Buffers can be iterated over like arrays and even converted to objects, hex strings and then back to buffers. Importantly buffers are an efficient way to store raw data. They are deeply interwoven with streams of data, as the data can be stored in buffers. A great example of buffers is a buffer on video; the data (image and sound data) is stored the buffer so that smooth audio and video playback can be assured. I’m just getting a handle on buffers, but I’m sure my appreciation and understanding of their usefulness will develop rapidly over the next week or so.