Streaming a csv file to a console app with minimal api-How?

KKosta11/20/2022
Hey Guys got this methode:
    public string MakeHttpCall()
    {
        var watch = new Stopwatch();
        Stopwatch.StartNew();
        using (var reader = new StreamReader(@"C:\Users\kosta\source\repos\gRPCDemoUsingNET6\gRPCDemoUsingNET6\Data"))
        {
            while (!reader.EndOfStream)
            {
                var line = reader.ReadLine();
                var values = line.Split(';');

            }
            return string.Empty;
        }
    }
}

And this one in the Ui:
var client = new HttpClient();
await using Stream stream =
    await client.GetStreamAsync("http://localhost:5276");
var lines =
    await JsonSerializer.DeserializeAsync<List<string>>(stream);
foreach (var line in lines)
{
    Console.WriteLine(line);

}

I want to stream the csv file to the ui, which happens here
 while (!reader.EndOfStream)
            {
                var line = reader.ReadLine();
                var values = line.Split(';');

            }

Unsure how to do that
Pphaseshift11/20/2022
you should use IAsyncEnumerable# in the endpoint
Some reading/examples:
https://anthonychu.ca/post/async-streams-dotnet-core-3-iasyncenumerable/
KKosta11/22/2022
@phaseshift that worked. amazing, thanks