Reputation: 50190
as a fun experiment (expected a notsupported exception) I did this is App.razor
protected override async Task OnInitializedAsync() {
string[] lines =
{
"First line", "Second line", "Third line"
};
await File.WriteAllLinesAsync("WriteLines.txt", lines);
string[] lines2 = System.IO.File.ReadAllLines(@"WriteLines.txt");
}
and it works fine. Where did the data go?
Upvotes: 3
Views: 587
Reputation: 273244
Blazor has access to a memory based filesystem (memfs). I can't find much info about it, it's somewhere on the border between Mono and Blazor.
You can for instance do System.IO.Directory.GetFiles("/");
and see (only) the WriteLines.txt file you just created.
Where did the data go?
Somewhere in the memory of the Browser.
Upvotes: 2