AgileCoding.Extentions.File
2.0.5
dotnet add package AgileCoding.Extentions.File --version 2.0.5
NuGet\Install-Package AgileCoding.Extentions.File -Version 2.0.5
<PackageReference Include="AgileCoding.Extentions.File" Version="2.0.5" />
paket add AgileCoding.Extentions.File --version 2.0.5
#r "nuget: AgileCoding.Extentions.File, 2.0.5"
// Install AgileCoding.Extentions.File as a Cake Addin #addin nuget:?package=AgileCoding.Extentions.File&version=2.0.5 // Install AgileCoding.Extentions.File as a Cake Tool #tool nuget:?package=AgileCoding.Extentions.File&version=2.0.5
AgileCoding.Extensions.File
Overview
AgileCoding.Extensions.File is a .NET 6.0 library that provides useful extensions for file related operations. This includes validating file existence, checking if a file is in use, creating a file name with a specific extension, and more.
Installation
This library is available as a NuGet package. You can install it using the NuGet package manager console:
bashCopy code
Install-Package AgileCoding.Extensions.File -Version 2.0.5
Features
The library provides various functionalities such as:
- Check File Existence: The
FileExist
extension method checks if a given file path points to an existing file. - Create File and Delete If Exist: The
CreateFileAndDelteIfExist
extension method creates a new file at the given path and deletes any existing file. - Create Filename With Extension: The
CreateFileNameWithExtention
extension method creates a filename with the given extension. - Get File Hash: The
GetFileHash
extension method calculates and returns the SHA1 hash of a file. - Read All Lines: The
AllLines
extension method reads all the lines of a file. - File Is In Use: The
FileIsInUse
extension method checks if a file is being used by another process. - Shift Directory Back: The
ShiftDirectotyBack
extension method shifts the directory back a specified number of times.
Usage
Here's an example of how to use these features:
using AgileCoding.Extentions.Files;
using System.IO;
string filePath = "your/file/path.txt";
// Check if file exists
bool exists = filePath.FileExist();
// Throw exception if file doesn't exist
filePath.ThrowIfFileDoesntExist<FileNotFoundException>("File does not exist");
// Create filename with extension
string filename = "myFile";
string newFilename = filename.CreateFileNameWithExtention("txt");
// Create file and delete if it exists
FileInfo file = filePath.CreateFileAndDelteIfExist();
// Read all lines in the file
IEnumerable<string> lines = file.AllLines();
// And so on...
Documentation
For more detailed information about the usage of this library, please refer to the official documentation.
License
This project is licensed under the terms of the MIT license. For more information, see the LICENSE file.
Contributing
Contributions are welcome! Please see our contributing guidelines for more details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
-
net6.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AgileCoding.Extentions.File:
Package | Downloads |
---|---|
AgileCoding.Extentions.ConfigurationManager
Extensions related to ConfiguraitonManager functionality |
GitHub repositories
This package is not used by any popular GitHub repositories.
Moving to core