FileSnap 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package FileSnap --version 1.0.1                
NuGet\Install-Package FileSnap -Version 1.0.1                
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="FileSnap" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FileSnap --version 1.0.1                
#r "nuget: FileSnap, 1.0.1"                
#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 FileSnap as a Cake Addin
#addin nuget:?package=FileSnap&version=1.0.1

// Install FileSnap as a Cake Tool
#tool nuget:?package=FileSnap&version=1.0.1                

FileSnap

FileSnap is a .NET library designed to capture, compare, and restore file system snapshots. It allows you to take snapshots of a file system at a given point in time, record file and directory states (including metadata such as file sizes, timestamps, and attributes), compare different snapshots to identify changes (new, modified, or deleted files), and restore file system states to a previous snapshot. This library is useful for scenarios such as backup, security, auditing, file integrity monitoring, and implementing versioned file systems or system restore capabilities.

Features

  • Capture Snapshots: Record the state of files and directories, including metadata and content.
  • Compare Snapshots: Identify changes between snapshots, including new, modified, and deleted files.
  • Restore Snapshots: Restore file system states to a previous snapshot, including file content and metadata.
  • Optimized Storage: Uses compression to minimize storage space for snapshots.
  • Cross-Platform: Compatible with Windows, macOS, and Linux.

Installation

To install FileSnap, add the following package to your .NET project:

dotnet add package FileSnap

Usage

Capturing a Snapshot

using FileSnap.Core.Services;

var snapshotService = new SnapshotService(new HashingService());
var snapshot = await snapshotService.CaptureSnapshot("path/to/directory");
await snapshotService.SaveSnapshot(snapshot, "path/to/save/snapshot.json");

Loading and Comparing Snapshots

var snapshotService = new SnapshotService(new HashingService());
var beforeSnapshot = await snapshotService.LoadSnapshot("path/to/before/snapshot.json");
var afterSnapshot = await snapshotService.LoadSnapshot("path/to/after/snapshot.json");

var comparisonService = new ComparisonService();
var differences = comparisonService.Compare(beforeSnapshot, afterSnapshot);

Restoring a Snapshot

var snapshotService = new SnapshotService(new HashingService());
var snapshot = await snapshotService.LoadSnapshot("path/to/snapshot.json");

var restorationService = new RestorationService();
await restorationService.RestoreSnapshot(snapshot, "path/to/restore/directory");

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

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

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.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.6 85 12/2/2024
1.0.5 79 12/2/2024
1.0.4 80 12/2/2024
1.0.2 82 12/1/2024
1.0.1 81 11/30/2024