I'm using streaming response on server side - running sinatra.
How can I handle the client side file download (javascript + angular) in a way, that my streaming response would not get fully loaded first and offered only afterwards to be saved to file?
My current impl. looks similar to this one (using FileSaver):
$http.post('/foo', bar)
.success(function (data) {
var blob = new Blob([data], {type: "text/plain;charset=utf-8"});
saveAs(blob, 'A.csv');
}).
Still I feel like response gets downloaded completely first and only afterwards offered for save.
The thing is, that file downloaded can be huge, so just wanted to provide fast response to end user.