in my project (Backend: c# - Frontend: JavaScript) I want to send a csv file as MemoryStream in a response object to the frontend.
At first I sent back a HttpResponse object which worked. But now I would like to send other information back, alongside the MemoryStream.
Something like this:
{
Stream = stream,
Succeded = true,
Messages = "text"
}
Is this even possible? It didn't work for me, using Axios for the fetch.
You should be able to send any objects that can be read as JSON. Your CSV will eventually be converted to a string before the response gets send. Your backend will not stream the CSV but rather the response is send all at once.
You could try to serialize your object to a JSON string and return that string in the HttpResponse. Then you could read it in your frontend.