𝗗𝗮𝘆 𝟯𝟵 𝗼𝗳 𝗟𝗲𝗮𝗿𝗻𝗶𝗻𝗴 𝗠𝗘𝗥𝗡 𝗦𝘁𝗮𝗰𝗸

I am on day 39 of my MERN stack journey.

Yesterday I studied HTTP verbs like GET and POST. Today I focused on backend operations. I studied how servers handle data streams and body parsing.

When a user sends a form or a file, the server does not get it all at once. Data arrives in small pieces. These pieces are called chunks.

Node.js uses streams to save memory. It does not load a large file into your server memory immediately. Instead, it handles data in small parts.

Here is how the process works:

In Node.js, you do not get an instant request body. You listen to specific network events:

You use Buffer.concat to join the pieces. Then you convert them into a string.

This method keeps your server fast and efficient. It prevents memory crashes when handling large files.

Source: https://dev.to/ali_hamza_589ec7b3eb6688d/day-39-of-learning-mern-stack-hkp