PupaLib.FileIO 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package PupaLib.FileIO --version 1.0.1
                    
NuGet\Install-Package PupaLib.FileIO -Version 1.0.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="PupaLib.FileIO" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PupaLib.FileIO" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="PupaLib.FileIO" />
                    
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 PupaLib.FileIO --version 1.0.1
                    
#r "nuget: PupaLib.FileIO, 1.0.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 PupaLib.FileIO@1.0.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=PupaLib.FileIO&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=PupaLib.FileIO&version=1.0.1
                    
Install as a Cake Tool

๐Ÿงช๏ธ PupaLib.FileIO

C# Dotnet Nuget Github License

NuGet

PupaLib.FileIO is an incredibly simple library for working with files and folders. ๐ŸŽฏ

๐Ÿ—๏ธ Key Features

๐Ÿ† Feature ๐Ÿ“ Description
Easy to Use Simplifies file manipulation tasks ๐Ÿ› ๏ธ
Versatile Functionality - Create new files and folders ๐Ÿ“‚<br>- Read and write data efficiently ๐Ÿ“„
Cross-Platform Support Works seamlessly across different operating systems ๐ŸŒ
Lightweight Minimal impact on performance โšก

๐Ÿš€ Installation

You can install the package through the NuGet Package Manager or via the command line

dotnet add package PupaLib.FileIO

Or through the NuGet Package Manager

Install-Package PupaLib.FileIO

๐Ÿ’ก Usage

๐Ÿ› ๏ธ File or Folder Creation

Create a file:

var path = "./path/file_name.txt";
var file = VirtualFile.CreateFile(path);

Create a folder:

var path = "./path/folder_name";
var folder = VirtualFile.CreateFolder(path);

๐Ÿ”Ž Check If File or Folder Exists

Check for a file:

var path = "./path/file_name.txt";
var file = VirtualFile.GetFile(path);
if(file is not null) {
    Console.WriteLine($"File exists, path -> {file.MyPath}");    
} else {
    Console.WriteLine($"File not exists")
}

Check for a folder:

var path = "./path/folder_name";
var folder = VirtualFolder.GetFolder(path);
if(folder is not null) {
    Console.WriteLine($"Folder exists, path -> {folder.MyPath}");    
} else {
    Console.WriteLine($"Folder not exists")
}

๐Ÿ“ Write and Read Files

Writing to a text file:

var fileName = "file.txt";
var file = VirtualIo.RootFolder.GetFileIn(fileName);
if(file is not null) {
  var content = "Hello world!";
  await file.WriteStringAsync(content); // Write file
  Console.WriteLine($"Writes content [{content}] in file");
  Console.WriteLine($"File content: {await file.ReadStringAsync()}"); //Read file
  Console.WriteLine(file.GetInfo());
}

Writing with serialization:

var fileName = "file.txt";
var file = VirtualIo.RootFolder.GetFileIn(fileName);
if(file is not null) {
  var content = new ExampleObject("Name", "Lastname", [12, 53, 47]);
  file.WriteTContent<ExampleObject>(content, new JsonSystemSerializer()); // Write and serialize file
  Console.WriteLine($"Writes content [\n{content}\n] in file");
  Console.WriteLine($"File content: {file.ReadTContent<ExampleObject>(new JsonSystemSerializer())}"); //Read and deserialize file
  Console.WriteLine(file.GetInfo());
}

๐Ÿ—‘๏ธ Delete File and Folder

Deleting a file:

var fileName = "file.txt";
var file = VirtualIo.RootFolder.GetFileIn(fileName);
if(file is not null) {
  file.DeleteMe(); // Delete file
  Console.WriteLine($"File deleted, exists: {file.Exists}");
}

Deleting a folder:

var folderName = "folder";
var folder = VirtualIo.RootFolder.GetFolderIn(folderName);
if(folder is not null) {
  folder.DeleteMe(); //Delete folder
  Console.WriteLine($"Folder deleted, exists: {folder.Exists}");
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on PupaLib.FileIO:

Package Downloads
PupaMVCF.Framework

Simplify MVC web framework on csharp

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.1 169 4/24/2026
1.3.0 103 4/24/2026
1.2.1 146 4/12/2026
1.2.0 987 3/17/2026
1.0.1 401 1/7/2026