FileDeporter.Core 1.0.0

dotnet add package FileDeporter.Core --version 1.0.0
                    
NuGet\Install-Package FileDeporter.Core -Version 1.0.0
                    
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="FileDeporter.Core" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FileDeporter.Core" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="FileDeporter.Core" />
                    
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 FileDeporter.Core --version 1.0.0
                    
#r "nuget: FileDeporter.Core, 1.0.0"
                    
#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 FileDeporter.Core@1.0.0
                    
#: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=FileDeporter.Core&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=FileDeporter.Core&version=1.0.0
                    
Install as a Cake Tool

FileDeporter.Core

A secure file operations library with integrity verification capabilities for .NET applications.

🚀 Features

  • Secure File Operations: SHA256 integrity verification for file transfers
  • Multiple Operation Types: Move and copy operations with safety options
  • Performance Options: Safe (with verification) and unsafe (fast) variants
  • Full IntelliSense Support: Comprehensive XML documentation
  • Cross-Platform: Compatible with Windows, Linux, and macOS
  • .NET 10.0: Built on the latest .NET framework

📦 Installation

Install the package from NuGet:

dotnet add package FileDeporter.Core

Or via Package Manager Console:

Install-Package FileDeporter.Core

🔧 Quick Start

using FileDeporter.Core;

var fileOps = new FileOperationsService();

// Safe move with integrity verification
await fileOps.MoveFileAsync(@"C:\source\file.txt", @"C:\destination\");

// Safe copy with integrity verification
await fileOps.CopyFileAsync(@"C:\source\file.txt", @"C:\destination\");

// Unsafe move (faster, no verification)
await fileOps.MoveFileUnsafeAsync(@"C:\source\file.txt", @"C:\destination\");

// Unsafe copy (faster, no verification)
await fileOps.CopyFileUnsafeAsync(@"C:\source\file.txt", @"C:\destination\");

📋 API Reference

FileOperationsService

Safe Operations (with SHA256 verification)
MoveFileAsync(string filePath, string destinationPath)

Moves a file with integrity verification.

Parameters:

  • filePath: Source file path
  • destinationPath: Destination directory path

Returns: Task<bool> - True if successful

Exceptions:

  • FileNotFoundException: Source file doesn't exist
  • DirectoryNotFoundException: Destination directory doesn't exist
  • InvalidOperationException: Integrity verification fails
CopyFileAsync(string filePath, string destinationPath)

Copies a file with integrity verification, preserving the source.

Parameters: Same as MoveFileAsync Returns: Same as MoveFileAsync Exceptions: Same as MoveFileAsync

Unsafe Operations (without verification)
MoveFileUnsafeAsync(string filePath, string destinationPath)

Moves a file without integrity verification (faster).

CopyFileUnsafeAsync(string filePath, string destinationPath)

Copies a file without integrity verification (faster).

Utility Methods
HashFileCreator(string filePath)

Calculates SHA256 hash of a file.

Parameters:

  • filePath: File to hash

Returns: Task<string> - Hexadecimal SHA256 hash

⚡ Performance Comparison

Operation Safe (with verification) Unsafe (without verification)
Move Slower but secure Faster but no integrity check
Copy Slower but secure Faster but no integrity check

Recommendation: Use safe operations for critical file transfers where integrity is important. Use unsafe operations for non-critical transfers where performance is priority.

🔒 Security Features

  • SHA256 Hashing: Cryptographic integrity verification
  • Automatic Cleanup: Failed operations clean up partial files
  • Exception Handling: Comprehensive error reporting
  • Path Validation: Validates source and destination paths

📝 Examples

Basic File Move

try
{
    var fileOps = new FileOperationsService();
    bool success = await fileOps.MoveFileAsync(
        @"C:\documents\report.pdf", 
        @"C:\backup\"
    );
    
    if (success)
    {
        Console.WriteLine("File moved successfully with integrity verification!");
    }
}
catch (Exception ex)
{
    Console.WriteLine($"Error: {ex.Message}");
}

Batch Operations

var fileOps = new FileOperationsService();
var sourceFiles = Directory.GetFiles(@"C:\source\", "*.txt");
var destination = @"C:\dest\";

foreach (var file in sourceFiles)
{
    try
    {
        await fileOps.CopyFileAsync(file, destination);
        Console.WriteLine($"Copied: {Path.GetFileName(file)}");
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Failed to copy {file}: {ex.Message}");
    }
}

Custom Hash Verification

var fileOps = new FileOperationsService();

// Calculate hash before operation
string originalHash = await fileOps.HashFileCreator(@"C:\source\important.dat");

// Perform operation
await fileOps.CopyFileAsync(@"C:\source\important.dat", @"C:\backup\");

// Verify after operation
string backupHash = await fileOps.HashFileCreator(@"C:\backup\important.dat");

if (originalHash == backupHash)
{
    Console.WriteLine("Integrity verified!");
}

🛠️ Requirements

  • .NET 10.0 or higher
  • Compatible with:
    • Windows 10/11
    • Linux (Ubuntu 18.04+, etc.)
    • macOS 10.15+

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📞 Support

If you encounter any issues or have questions:

  • Create an issue on GitHub
  • Check the documentation
  • Review the API reference above

📊 Package Information

  • Package ID: FileDeporter.Core
  • Version: 1.0.0
  • Author: FileDeporter Team
  • Tags: file, operations, integrity, verification, sha256
  • Target Framework: net10.0

Note: Always test file operations with non-critical data first to ensure they meet your requirements.

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

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 112 3/23/2026