Czlovek.Files 1.0.6-beta.1

This is a prerelease version of Czlovek.Files.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Czlovek.Files --version 1.0.6-beta.1
                    
NuGet\Install-Package Czlovek.Files -Version 1.0.6-beta.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Czlovek.Files" Version="1.0.6-beta.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Czlovek.Files" Version="1.0.6-beta.1" />
                    
Directory.Packages.props
<PackageReference Include="Czlovek.Files" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Czlovek.Files --version 1.0.6-beta.1
                    
#r "nuget: Czlovek.Files, 1.0.6-beta.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Czlovek.Files@1.0.6-beta.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Czlovek.Files&version=1.0.6-beta.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Czlovek.Files&version=1.0.6-beta.1&prerelease
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.73 139 11/6/2025
2.1.0-beta.72 131 11/6/2025
2.1.0-beta.71 135 11/4/2025
2.1.0-beta.70 132 11/4/2025
2.1.0-beta.69 133 11/4/2025
2.1.0-beta.68 142 11/4/2025
2.1.0-beta.67 143 11/2/2025
2.1.0-beta.66 143 11/2/2025
2.1.0-beta.65 73 11/1/2025
2.1.0-beta.64 75 11/1/2025
2.1.0-beta.63 78 11/1/2025
2.1.0-beta.62 71 11/1/2025
2.1.0-beta.61 139 10/12/2025
2.1.0-beta.59 146 8/13/2025
2.1.0-beta.58 130 8/13/2025
2.1.0-beta.57 130 8/13/2025
2.1.0-beta.56 127 8/12/2025
2.1.0-beta.55 127 8/12/2025
2.1.0-beta.54 133 8/10/2025
2.1.0-beta.53 125 8/10/2025
2.1.0-beta.52 127 8/10/2025
2.1.0-beta.51 98 8/9/2025
2.1.0-beta.50 95 8/9/2025
2.1.0-beta.49 95 8/9/2025
2.1.0-beta.48 104 8/9/2025
2.1.0-beta.47 104 8/9/2025
2.1.0-beta.46 145 7/29/2025
2.1.0-beta.45 100 7/29/2025
2.1.0-beta.44 100 7/29/2025
2.1.0-beta.43 148 7/5/2025
2.1.0-beta.42 129 6/23/2025
2.1.0-beta.41 100 6/6/2025
2.1.0-beta.40 81 6/6/2025
2.1.0-beta.38 160 6/3/2025
2.1.0-beta.37 133 5/27/2025
2.1.0-beta.36 70 5/10/2025
2.1.0-beta.35 57 5/10/2025
2.1.0-beta.34 57 5/10/2025
2.1.0-beta.33 206 4/10/2025
2.1.0-beta.32 148 4/9/2025
2.1.0-beta.31 142 4/9/2025
2.1.0-beta.30 140 4/9/2025
2.1.0-beta.29 146 4/9/2025
2.1.0-beta.28 180 3/11/2025
2.1.0-beta.27 167 3/9/2025
2.1.0-beta.26 114 3/8/2025
2.1.0-beta.25 128 3/8/2025
2.1.0-beta.24 200 3/6/2025
2.1.0-beta.23 185 3/4/2025
2.1.0-beta.22 185 3/4/2025
2.1.0-beta.21 103 2/23/2025
2.1.0-beta.20 80 2/22/2025
2.1.0-beta.19 76 2/22/2025
2.1.0-beta.18 76 2/22/2025
2.1.0-beta.17 78 2/22/2025
2.1.0-beta.16 73 2/22/2025
2.1.0-beta.15 73 2/22/2025
2.1.0-beta.14 71 2/22/2025
2.1.0-beta.13 74 2/22/2025
2.1.0-beta.12 84 2/22/2025
2.1.0-beta.11 100 2/21/2025
2.1.0-beta.10 89 2/20/2025
2.1.0-beta.9 82 1/20/2025
2.1.0-beta.8 80 1/20/2025
2.1.0-beta.7 72 1/20/2025
2.1.0-beta.6 73 1/20/2025
2.1.0-beta.5 82 1/19/2025
2.1.0-beta.4 69 1/19/2025
2.1.0-beta.3 76 1/19/2025
2.1.0-beta.2 59 1/19/2025
2.1.0-beta.1 63 1/19/2025
2.0.0-beta.8 233 8/25/2024
2.0.0-beta.7 190 6/11/2024
2.0.0-beta.5 72 6/11/2024
2.0.0-beta.4 84 6/10/2024
2.0.0-beta.3 88 5/19/2024
2.0.0-beta.2 757 2/7/2024
2.0.0-beta.1 99 1/18/2024
1.0.11-beta.40 159 12/17/2023
1.0.11-beta.39 114 12/10/2023
1.0.11-beta.38 116 11/26/2023
1.0.11-beta.37 86 11/26/2023
1.0.11-beta.36 91 11/25/2023
1.0.11-beta.35 88 11/25/2023
1.0.11-beta.34 92 11/25/2023
1.0.11-beta.33 97 11/25/2023
1.0.11-beta.32 94 11/25/2023
1.0.11-beta.31 89 11/23/2023
1.0.11-beta.30 96 11/18/2023
1.0.11-beta.29 88 11/17/2023
1.0.11-beta.28 86 11/17/2023
1.0.11-beta.27 83 11/16/2023
1.0.11-beta.26 83 11/16/2023
1.0.11-beta.25 85 11/16/2023
1.0.11-beta.24 110 11/1/2023
1.0.11-beta.23 92 10/31/2023
1.0.11-beta.22 141 9/11/2023
1.0.11-beta.21 122 9/10/2023
1.0.11-beta.20 177 8/26/2023
1.0.11-beta.19 125 8/18/2023
1.0.11-beta.18 124 8/17/2023
1.0.11-beta.17 116 8/17/2023
1.0.11-beta.16 121 8/17/2023
1.0.11-beta.15 110 8/17/2023
1.0.11-beta.14 126 8/15/2023
1.0.11-beta.13 130 8/11/2023
1.0.11-beta.12 127 8/11/2023
1.0.11-beta.11 137 8/3/2023
1.0.11-beta.10 149 8/1/2023
1.0.11-beta.9 143 7/11/2023
1.0.11-beta.8 134 7/11/2023
1.0.11-beta.7 132 7/11/2023
1.0.11-beta.6 148 5/16/2023
1.0.11-beta.5 140 5/16/2023
1.0.11-beta.4 143 5/16/2023
1.0.11-beta.3 146 5/16/2023
1.0.11-beta.2 139 5/16/2023
1.0.11-beta.1 146 5/14/2023
1.0.10 460 4/11/2023
1.0.10-beta.2 169 4/11/2023
1.0.10-beta.1 165 3/22/2023
1.0.9 347 3/22/2023
1.0.8 342 3/19/2023
1.0.7 355 3/19/2023
1.0.6 361 3/16/2023
1.0.6-beta.1 152 3/16/2023
1.0.5 360 3/16/2023
1.0.4 392 3/12/2023