As you can read in the Node.js documentation on the Buffer class, a buffer
is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap.
So far, so good.
What now puzzles me is the question what a buffer is technically speaking. Is it an array with just some additional functions for creating and converting to strings using specific encodings?
Or is there "more" to it?
A Buffer is a chunk of memory, just like you would have it in C/C++. You can interpret this memory as an array of integer or floating point numbers of various lengths, or as a binary string. Unlike higher-level data structures like arrays, a buffer is not resizable.
It corresponds roughly to:
char* or char[] in C/C++byte[] in Javabytes or a non-resizable bytearray in PythonExplanation from http://nodejitsu.com/...
Buffers are instances of the Buffer class in node, which is designed to handle raw binary data. Each buffer corresponds to some raw memory allocated outside V8. Buffers act somewhat like arrays of integers, but aren't resizable and have a whole bunch of methods specifically for binary data. In addition, the "integers" in a buffer each represent a byte and so are limited to values from 0 to 255 (2^8 - 1), inclusive.
Read more: Buffers in Node.js