PupaLib.FileIO
1.2.1
See the version list below for details.
dotnet add package PupaLib.FileIO --version 1.2.1
NuGet\Install-Package PupaLib.FileIO -Version 1.2.1
<PackageReference Include="PupaLib.FileIO" Version="1.2.1" />
<PackageVersion Include="PupaLib.FileIO" Version="1.2.1" />
<PackageReference Include="PupaLib.FileIO" />
paket add PupaLib.FileIO --version 1.2.1
#r "nuget: PupaLib.FileIO, 1.2.1"
#:package PupaLib.FileIO@1.2.1
#addin nuget:?package=PupaLib.FileIO&version=1.2.1
#tool nuget:?package=PupaLib.FileIO&version=1.2.1
<div align="center">
PupaLib.FileIO
PupaLib.FileIO is an incredibly simple library for working with files and folders. 🎯
<img src="https://github.com/Artpupser/PupaLib.FileIO/blob/main/assets/banner.jpg" style="border-radius: 20px; max-height: 500px">
</div>
📜 Content
🗝️ 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}");
}
🗃️ Devlog
1.2.1
- Changed .NET SDK version, .net8.0 → .net10.0
⚖️ License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.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.