Czlovek.Files
1.0.10
See the version list below for details.
dotnet add package Czlovek.Files --version 1.0.10
NuGet\Install-Package Czlovek.Files -Version 1.0.10
<PackageReference Include="Czlovek.Files" Version="1.0.10" />
<PackageVersion Include="Czlovek.Files" Version="1.0.10" />
<PackageReference Include="Czlovek.Files" />
paket add Czlovek.Files --version 1.0.10
#r "nuget: Czlovek.Files, 1.0.10"
#:package Czlovek.Files@1.0.10
#addin nuget:?package=Czlovek.Files&version=1.0.10
#tool nuget:?package=Czlovek.Files&version=1.0.10
Utils Class
The Utils
class provides a collection of static utility methods for working with files and directories.
Methods
IsNullOrEmpty
public static bool IsNullOrEmpty(string fileName)
Determines whether the specified file exists and has a length greater than zero.
fileName
: The name of the file to check.
Returns true
if the file exists and has a length greater than zero; otherwise, false
.
ReadAllTextAsync
public static async Task<string> ReadAllTextAsync(string path, Encoding? encoding = null)
Asynchronously reads the entire contents of a text file and returns the result as a string.
path
: The path to the file to read.encoding
: The encoding to use when reading the file. If null, the default encoding for the operating system is used.
Returns a Task
representing the completion of the file read operation. The result is the contents of the file as a string.
ResetFile
public static string ResetFile(params string[] paths)
Resets the contents of the specified files by overwriting them with an empty string.
paths
: The paths of the files to reset.
Returns a string containing the path(s) of the file(s) that were reset.
ResetDirectory
public static string ResetDirectory(params string[] paths)
Determines whether the specified directories exists and create new, empty directories in their place if not.
paths
: The paths of the directories to reset.
Returns a string containing the path(s) of the directory(s) that were reset.
WriteAllText
public static async Task<string> WriteAllText(string path, string content, Encoding? encoding = null)
Writes the specified content to a file at the specified path. If the file does not exist, it is created; otherwise, its contents are overwritten.
path
: The path of the file to write to.content
: The content to write to the file.encoding
: The character encoding to use when writing the file. If not specified, the default encoding is used.
Returns a task representing the asynchronous write operation.
Example Usage
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// Check if file exists and has a length greater than zero
bool fileExistsAndNotEmpty = Utils.IsNullOrEmpty("example.txt");
// Read the entire contents of a text file as a string
string fileContents = await Utils.ReadAllTextAsync("example.txt", Encoding.UTF8);
// Reset the contents of a file
string resetFilePath = Utils.ResetFile("example.txt");
// Reset the contents of a directory
string resetDirectoryPath = Utils.ResetDirectory("example_directory");
// Write text to a file
await Utils.WriteAllText("example.txt", "Hello, world!", Encoding.UTF8);
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net7.0
- Microsoft.Extensions.Logging (>= 7.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Czlovek.Files:
Package | Downloads |
---|---|
Czlovek.Security
A collection of methods for generating, hashing, and encrypting data. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.1.0-beta.61 | 100 | 10/12/2025 |
2.1.0-beta.59 | 142 | 8/13/2025 |
2.1.0-beta.58 | 125 | 8/13/2025 |
2.1.0-beta.57 | 125 | 8/13/2025 |
2.1.0-beta.56 | 123 | 8/12/2025 |
2.1.0-beta.55 | 121 | 8/12/2025 |
2.1.0-beta.54 | 127 | 8/10/2025 |
2.1.0-beta.53 | 121 | 8/10/2025 |
2.1.0-beta.52 | 121 | 8/10/2025 |
2.1.0-beta.51 | 92 | 8/9/2025 |
2.1.0-beta.50 | 91 | 8/9/2025 |
2.1.0-beta.49 | 89 | 8/9/2025 |
2.1.0-beta.48 | 97 | 8/9/2025 |
2.1.0-beta.47 | 100 | 8/9/2025 |
2.1.0-beta.46 | 139 | 7/29/2025 |
2.1.0-beta.45 | 96 | 7/29/2025 |
2.1.0-beta.44 | 95 | 7/29/2025 |
2.1.0-beta.43 | 144 | 7/5/2025 |
2.1.0-beta.42 | 124 | 6/23/2025 |
2.1.0-beta.41 | 96 | 6/6/2025 |
2.1.0-beta.40 | 76 | 6/6/2025 |
2.1.0-beta.38 | 157 | 6/3/2025 |
2.1.0-beta.37 | 130 | 5/27/2025 |
2.1.0-beta.36 | 67 | 5/10/2025 |
2.1.0-beta.35 | 54 | 5/10/2025 |
2.1.0-beta.34 | 54 | 5/10/2025 |
2.1.0-beta.33 | 203 | 4/10/2025 |
2.1.0-beta.32 | 145 | 4/9/2025 |
2.1.0-beta.31 | 138 | 4/9/2025 |
2.1.0-beta.30 | 137 | 4/9/2025 |
2.1.0-beta.29 | 143 | 4/9/2025 |
2.1.0-beta.28 | 176 | 3/11/2025 |
2.1.0-beta.27 | 164 | 3/9/2025 |
2.1.0-beta.26 | 111 | 3/8/2025 |
2.1.0-beta.25 | 124 | 3/8/2025 |
2.1.0-beta.24 | 195 | 3/6/2025 |
2.1.0-beta.23 | 182 | 3/4/2025 |
2.1.0-beta.22 | 182 | 3/4/2025 |
2.1.0-beta.21 | 100 | 2/23/2025 |
2.1.0-beta.20 | 76 | 2/22/2025 |
2.1.0-beta.19 | 72 | 2/22/2025 |
2.1.0-beta.18 | 71 | 2/22/2025 |
2.1.0-beta.17 | 75 | 2/22/2025 |
2.1.0-beta.16 | 70 | 2/22/2025 |
2.1.0-beta.15 | 70 | 2/22/2025 |
2.1.0-beta.14 | 67 | 2/22/2025 |
2.1.0-beta.13 | 71 | 2/22/2025 |
2.1.0-beta.12 | 80 | 2/22/2025 |
2.1.0-beta.11 | 97 | 2/21/2025 |
2.1.0-beta.10 | 84 | 2/20/2025 |
2.1.0-beta.9 | 80 | 1/20/2025 |
2.1.0-beta.8 | 77 | 1/20/2025 |
2.1.0-beta.7 | 69 | 1/20/2025 |
2.1.0-beta.6 | 70 | 1/20/2025 |
2.1.0-beta.5 | 78 | 1/19/2025 |
2.1.0-beta.4 | 67 | 1/19/2025 |
2.1.0-beta.3 | 73 | 1/19/2025 |
2.1.0-beta.2 | 57 | 1/19/2025 |
2.1.0-beta.1 | 61 | 1/19/2025 |
2.0.0-beta.8 | 230 | 8/25/2024 |
2.0.0-beta.7 | 188 | 6/11/2024 |
2.0.0-beta.5 | 70 | 6/11/2024 |
2.0.0-beta.4 | 82 | 6/10/2024 |
2.0.0-beta.3 | 83 | 5/19/2024 |
2.0.0-beta.2 | 755 | 2/7/2024 |
2.0.0-beta.1 | 97 | 1/18/2024 |
1.0.11-beta.40 | 156 | 12/17/2023 |
1.0.11-beta.39 | 112 | 12/10/2023 |
1.0.11-beta.38 | 114 | 11/26/2023 |
1.0.11-beta.37 | 82 | 11/26/2023 |
1.0.11-beta.36 | 88 | 11/25/2023 |
1.0.11-beta.35 | 86 | 11/25/2023 |
1.0.11-beta.34 | 90 | 11/25/2023 |
1.0.11-beta.33 | 95 | 11/25/2023 |
1.0.11-beta.32 | 92 | 11/25/2023 |
1.0.11-beta.31 | 86 | 11/23/2023 |
1.0.11-beta.30 | 93 | 11/18/2023 |
1.0.11-beta.29 | 85 | 11/17/2023 |
1.0.11-beta.28 | 84 | 11/17/2023 |
1.0.11-beta.27 | 81 | 11/16/2023 |
1.0.11-beta.26 | 81 | 11/16/2023 |
1.0.11-beta.25 | 82 | 11/16/2023 |
1.0.11-beta.24 | 108 | 11/1/2023 |
1.0.11-beta.23 | 89 | 10/31/2023 |
1.0.11-beta.22 | 137 | 9/11/2023 |
1.0.11-beta.21 | 120 | 9/10/2023 |
1.0.11-beta.20 | 174 | 8/26/2023 |
1.0.11-beta.19 | 123 | 8/18/2023 |
1.0.11-beta.18 | 121 | 8/17/2023 |
1.0.11-beta.17 | 113 | 8/17/2023 |
1.0.11-beta.16 | 119 | 8/17/2023 |
1.0.11-beta.15 | 108 | 8/17/2023 |
1.0.11-beta.14 | 123 | 8/15/2023 |
1.0.11-beta.13 | 128 | 8/11/2023 |
1.0.11-beta.12 | 124 | 8/11/2023 |
1.0.11-beta.11 | 135 | 8/3/2023 |
1.0.11-beta.10 | 147 | 8/1/2023 |
1.0.11-beta.9 | 138 | 7/11/2023 |
1.0.11-beta.8 | 127 | 7/11/2023 |
1.0.11-beta.7 | 127 | 7/11/2023 |
1.0.11-beta.6 | 141 | 5/16/2023 |
1.0.11-beta.5 | 134 | 5/16/2023 |
1.0.11-beta.4 | 136 | 5/16/2023 |
1.0.11-beta.3 | 138 | 5/16/2023 |
1.0.11-beta.2 | 133 | 5/16/2023 |
1.0.11-beta.1 | 139 | 5/14/2023 |
1.0.10 | 444 | 4/11/2023 |
1.0.10-beta.2 | 158 | 4/11/2023 |
1.0.10-beta.1 | 158 | 3/22/2023 |
1.0.9 | 340 | 3/22/2023 |
1.0.8 | 334 | 3/19/2023 |
1.0.7 | 348 | 3/19/2023 |
1.0.6 | 354 | 3/16/2023 |
1.0.6-beta.1 | 144 | 3/16/2023 |
1.0.5 | 352 | 3/16/2023 |
1.0.4 | 385 | 3/12/2023 |