FileDeporter.Core
1.0.0
dotnet add package FileDeporter.Core --version 1.0.0
NuGet\Install-Package FileDeporter.Core -Version 1.0.0
<PackageReference Include="FileDeporter.Core" Version="1.0.0" />
<PackageVersion Include="FileDeporter.Core" Version="1.0.0" />
<PackageReference Include="FileDeporter.Core" />
paket add FileDeporter.Core --version 1.0.0
#r "nuget: FileDeporter.Core, 1.0.0"
#:package FileDeporter.Core@1.0.0
#addin nuget:?package=FileDeporter.Core&version=1.0.0
#tool nuget:?package=FileDeporter.Core&version=1.0.0
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 pathdestinationPath: Destination directory path
Returns: Task<bool> - True if successful
Exceptions:
FileNotFoundException: Source file doesn't existDirectoryNotFoundException: Destination directory doesn't existInvalidOperationException: 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
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - 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 | 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
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 |