Buffer
Understand the workings of the Buffer class in Node.js.
We'll cover the following
What is a buffer?
Buffers in the context of computers refer to a temporary data storage that is used when moving data. Moving data can mean a lot of things. The most common, nowadays, would be video streaming. Depending on how fast your internet is, your video quality can change and so can your viewing experience. Video data is fetched from the server, stored in the buffer, processed, and sent to your display. This is why when you click on a video, you do not wait for it to download completely; instead, it starts playing right away. As more data is fetched, the buffer gets filled with newer data and old data is usually overwritten.
Buffers can help in synchronous operations as well, since the program does not have to wait for the entire file to be read from a local or network resource. Instead, as soon as some of the data arrives, the program can start processing it or move on to process more code.
Get hands-on with 1400+ tech skills courses.