Where to read from (an HTTP response object on a client, or an HTTP request object on a server).
The number of bytes to read, or 0 to read all the way to the end of the message. (Note, not the number of string characters).
If an encoding's given it's used to return the data as a string, otherwise it's returned as an array of node.js Buffer objects.
The function to be called when the read completes if lhttp_read() returned null.
If the requested length has already been read from the network then return the read data, otherwise return null.
On a client read len bytes from the server's HTTP response, or on a server read len bytes from the client's HTTP request. Or read all the way to the end of the reponse/request data by passing 0 for the len parameter. If chan.setEncoding() has been called to set a string encoding for the request/response then lhttp_read() won't work correctly. If an encoding's given then it's used to provide the data read as a string, otherwise it's provided as an array of node.js Buffer objects. Note that the length is in bytes as distinct from string characters. If the requested length has already been read from the network then doneCallback() isn't called, instead the data's returned immediately. Otherwise lhttp_read() returns null and doneCallback()'s called later to indicate completeion. If doneCallback() is called and something went wrong then the e parameter contains an Error object. If e is null, then the data read is in doneCallback()'s data parameter, and msgEnded is set to true if lhttp_read() detected the end of the message. If the message ends before the requested length is read then lhttp_read() returns less than the requested length. Check the length of the data returned to watch for this. Note that the request/response has a boolean property complete which will be true if a complete HTTP message has been received successfully.