GithubHelp home page GithubHelp logo

pavadik / zio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xoofx/zio

0.0 0.0 0.0 552 KB

A cross-platform abstract/virtual filesystem framework with many built-ins filesystems for .NET

License: BSD 2-Clause "Simplified" License

C# 100.00%

zio's Introduction

Zio Build Status Coverage Status NuGet

Zio provides a simple, powerful, cross-platform filesystem abstraction for .NET with many built-ins filesystems.

Features

  • Compatible with .NET 4.0, 4.5+ and the cross platform .NET Core/Standard 1.3+
  • API providing all operations provided by the regular System.IO API (e.g File.Move, Directory.Delete... etc.)
    • Allowing atomic filesystem operations (e.g File.Replace...)
  • A simple interface abstraction IFileSystem
  • Supports for filesystem watcher through the IFileSystem.Watch method and the IFileSystemWatcher interface
    • For all builtin filesystems (aggregates, memory...etc.)
  • All paths are normalized through a lightweight uniform path struct UPath
  • Multiple built-ins filesystems:
    • PhysicalFileSystem to access the physical disks, directories and folders.
      • With uniform paths, this filesystem on Windows is working like on a Windows Subsystem Linux (WSL), by remapping drives to mount directory (e.g path /mnt/c/Windows equivalent to C:\Windows)
    • MemoryFileSystem to access a filesystem in memory:
      • Trying to be 100% compatible with a true PhysicalFileSystem (including exceptions)
      • Efficient concurrency with a per node (file or directory) locking mechanism
      • A safe hierarchical locking strategy (following Unix kernel recommendations for directory locking)
      • Support for FileShare.Read, FileShare.Write and FileShare.ReadWrite
      • Internally support for filesystem atomic operations (File.Replace)
    • On top of these final filesystem, you can compose more complex filesystems:
      • AggregateFileSystem providing a read-only filesystem aggregating multiple filesystem that offers a merged view
      • MountFileSystem to mount different filesystems at a specific mount point name
      • SubFileSystem to view a sub-folder of another filesystem as if it was a root / directory
      • ReadOnlyFileSystem to interact safely with another filesystem in read-only mode
  • Higher level API similar to FileSystemEntry, FileEntry and DirectoryEntry offering a similar API to their respective FileSystemInfo, FileInfo, DirectoryInfo

Usage

Accessing a physical filesystem:

var fs = new PhysicalFileSystem();
foreach(var dir in fs.EnumerateDirectories("/mnt/c"))
{
    // ...
}

Using an in-memory filesystem:

var fs = new MemoryFileSystem();
fs.WriteAllText("/temp.txt", "This is a content");
if (fs.FileExists("/temp.txt"))
{
    Console.WriteLine("The content of the file:" + fs.ReadAllText("/temp.txt"))
}

The following documentation provides more information about the API and how to use it.

Documentation

The documentation is directly available as part of this repository in the /doc folder.

Download

Zio is available as a NuGet package: NuGet

Build

In order to build Zio, you need to install Visual Studio 2017 with latest .NET Core

TODO

  • Add support for ZipArchive (readonly, readwrite)
  • Add support for Git FileSystem (readonly)

License

This software is released under the BSD-Clause 2 license.

Credits

The logo is File by jeff from the Noun Project

Author

Alexandre MUTEL aka xoofx

zio's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.