Thunder.Files 1.3.0

dotnet add package Thunder.Files --version 1.3.0                
NuGet\Install-Package Thunder.Files -Version 1.3.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="Thunder.Files" Version="1.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Thunder.Files --version 1.3.0                
#r "nuget: Thunder.Files, 1.3.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.
// Install Thunder.Files as a Cake Addin
#addin nuget:?package=Thunder.Files&version=1.3.0

// Install Thunder.Files as a Cake Tool
#tool nuget:?package=Thunder.Files&version=1.3.0                

Thunder.Files

Offers a basic interface to work with files and directories

How to Use

This library provides a basic wrapper around DirectoryInfo and FileInfo that conforms to the provided IDirectory and IFile interfaces. These interfaces also have some additional helpers.

To get the an IFile, you can do any of these:

    IFile file1 = new FileInfoWrapper("/path/to/file.txt");
    
    IFile file2 = "/path/to/file.txt".AsFile();
    
    IFile file3 = new FileInfo("/path/to/file.txt").Wrap();
    
    IFile file4 = new FileInfoWrapper(new FileInfo("/path/to/file.txt"));

With an IFile, you can use the interface to:

  • Copy to another file
  • Create the file
  • Delete the file
  • Find, get, or create siblings
  • Rename the file
  • Move the file
  • Open the file stream
  • Write or read file contents

Why?

This exists mainly to help mock file systems when possible when working with files in testing.

Roadmap

  • A potential path is to allow/permit semi-automatic file reading/writing based on various rules or configurations. For example, assuming a rule that a *.json file can always be read/written via a JsonReaderWriter, then we could simplify reading/writing to:
    var file = "my-file.json".AsFile();
    //from needing to specify type of reader or writer:
    var readerWriter = new JsonReaderWriter();
    var results = file.ReadContents<TestObject>(readerWriter);
    
    //to system automatically finding reader/writer based on "json" extension:
    var results = file.ReadContents<TestObject>(); 
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 Thunder.Files:

Package Downloads
Thunder.Files.Json

A small library that provides a JsonReaderWriter that works with IFile from Thunder.Files.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 212 8/7/2023
1.2.0 178 7/20/2023
1.1.0 169 7/19/2023
1.0.0 175 7/19/2023

This library is brand new and has limited features.