Created
January 21, 2022 12:30
-
-
Save liebki/db0ac74c2ee8c539fc33d2cd07505aeb to your computer and use it in GitHub Desktop.
Custom component for razor (blazor server-side), to read files (or folders) in local filesystem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@code { | |
[Parameter] | |
public string? path { get; set; } | |
} | |
<h3>@data</h3> | |
@code { | |
public string? data { get; set; } | |
protected override async Task OnInitializedAsync() | |
{ | |
string readData = ""; | |
if(path != null) | |
{ | |
readData = File.ReadAllText(@path); | |
} | |
data = readData; | |
StateHasChanged(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment