Do you want a better understanding of Buffer in Node.js? reading 4 notes - liz-kavalski-401-advanced-javascript/seattle-javascript-401n13 GitHub Wiki
Do you want a better understanding of Buffer in Node.js?
- Buffer is a class that was introduced as part of the Node.js API to make it possible to manipulate or interact with streams of binary data.
Binary
- Binary is simply a set or a collection of 1s and 0s.
- Each 1 and 0 are called a bit which is short for Binary digIT.
- Computer convert data into binary representation.
- Including strings, images, and/or videos.
- The computer convert them into a numbers and then to a binary representation.
- Character Sets are already defined rules of what exact number represents each character.
- Their are different definitions rules such as Unicode and ASCII.
- JavaScript get along with the Unicode.
- Their are also rules about how to turn numbers to represent binary.
- Character Encoding is the UTF-8, which states that characters should be encoded in bytes.
- Bytes is set of eight bits — eight 1s and 0s.
Stream
- Stream in Node.js simply means a sequence of data being moved from one point to the other over time.
- Don't need all the data before starting to process.
- Data is broken down into chunks.
Buffer
- The buffer is the 'waiting area' of information before it streams.
- Is like a bus stop.
- Node.js will automatically create during a stream
- Can create and manipulate your own buffer.