What is chunk in Node.js ?
The data is a transfer from server to client for a particular request in the form of a stream. The stream contains chunks. A chunk is a fragment of the data that is sent by the client to server all chunks concepts to each other to make a buffer of the stream then the buffer is converted into meaningful data. In this article, we will discuss how to send chunks from the request body to the server. The request object is used for handling the chunks of data.
Parameters: This function accepts the following two parameters:
- eventName: It is the name of the event that fired
- callback: It is the Callback function i.e Event handler of the particular event.
Return type: The return type of this method is void.
Example: Create an index.js file with the following code.
Run index.js file using below command:
Now open a browser and go to http://localhost:3000, you will see the following output.
Please Login to comment...