The Buff buff buffer - 401-advanced-javascript-aimurphy/seattle-javascript-401n13 GitHub Wiki

About Buffer

from freecodecamp.org

It's a class that allows you to interact with streams of binary data, by creating a waiting area for that data until it can be processed.

Binary data is normal stuff translated to computer readable 0s and 1s. Each set of 1s and 0s is a Binary digIT, or a BIT! :smiley:

We use UTF-8 a lot so this might be useful to know: In UTF-8 characters need to be encoded in bytes. A byte is 8bits. :space_invader:

So any character is going to be eight 0s and 1s long. For example:

The binary representation of the number 12 is 1100. So when UTF-8 state that 12 should be in eight bits, UTF-8 is saying that a computer needs to add more bits to the left side of the actual base-2 representation of the number 12 to make it a byte. So 12 should be stored as 00001100. Makes sense?

Back to buffer,

In node we can interact with buffer and make it bigger or smaller, make it a string and all sorts of things! Why? I'm not sure yet, I guess we will find that out tonight and add more here later.

One little, two little, three little Endians~ Endians

Not sure how this all goes together yet, either.