RequestBuffer enables late binding to the
end events for HTTP requests.
Binding to the standard
end events in Node.js'
http.ServerRequest can get complicated once your application needs to perform an async call (such as authenticating a user) before processing an HTTP request body.
The simple solution is to always make sure you bind to the request events before any asynchronous functions are called. But passing the request data around and handling it properly can be difficult, especially when using a framework where the request data may need to be passed around by several methods.
RequestBuffer enables you to bind to the data event whenever you need without missing any data.
var requestBuffer = ;// ...// Add the request buffer to the request object before any async callsserver;// ...;
npm install request-buffer