Streaming a csv file to a console app with minimal api-How?
Hey Guys got this methode:
And this one in the Ui:
I want to stream the csv file to the ui, which happens here
Unsure how to do that
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;
}
}
} 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);
}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(';');
} while (!reader.EndOfStream)
{
var line = reader.ReadLine();
var values = line.Split(';');
}Unsure how to do that
