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                
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="AgileCoding.Extentions.File" Version="2.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AgileCoding.Extentions.File --version 2.0.5                
#r "nuget: AgileCoding.Extentions.File, 2.0.5"                
#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.
// 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:

  1. Check File Existence: The FileExist extension method checks if a given file path points to an existing file.
  2. Create File and Delete If Exist: The CreateFileAndDelteIfExist extension method creates a new file at the given path and deletes any existing file.
  3. Create Filename With Extension: The CreateFileNameWithExtention extension method creates a filename with the given extension.
  4. Get File Hash: The GetFileHash extension method calculates and returns the SHA1 hash of a file.
  5. Read All Lines: The AllLines extension method reads all the lines of a file.
  6. File Is In Use: The FileIsInUse extension method checks if a file is being used by another process.
  7. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last updated
2.0.5 229 7/29/2023
1.0.0.2 467 6/10/2021
1.0.0.1 439 6/1/2021

Moving to core