Crow
Crow copied to clipboard
how to response a large data?
CROW_ROUTE(app, "/data")([&](const crow::request& req, crow::response& res) {
while (res.is_alive())
{
res.write(some_data_);
res.write(more_data_);
if (finished_)
break;
}
//data mayby 5-10GB
res.end();
});
but i find res.write is cached to "body" and send utill res.end() called.
emmm... how to response a large data without cached and send to the socket directly?
I believe Crow only does what you want currently with static files. It may be worthwhile to allow Crow to use a reference or pointer to a string as opposed to just a string as a body..
Unfortunately, until Crow's handlers become asynchronous, allowing the user direct access to the TCP connection is not a good idea...