It is very difficult for me to wrap my head around how to transfer data back to my client when using Nodejs / Expressjs.
I grab a lot of data from my database, and I do it in chunks, I would like to pass this back to the client as I receive the data, so I don't need to store the entire data set in memory, like a json object before sending back.
I would like the data to be transferred back to the file, i.e. I want the browser to ask my users what to do with the file at startup. Previously, I created a file system write stream and transferred the contents of my data to the file system, and then, when this was done, I sent the file back to the client. I would like to exclude the average person (creating a tmp file in the file system) and just transfer the data to the client.
app.get( '/api/export', function(req, res, next) { var notDone = true; while (notDone) { var partialData =
I can call res.write ("some string data") and then call res.end () when done. However, I am not 100% sure that this is actually a streaming response to the client when I write. It seems that expressjs stores all the data until I name the end and then send the response. It's true?
What is the correct way to stream data rows in response using expressjs?
lostintranslation
source share