GithubHelp home page GithubHelp logo

linven / cabinet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from visualeyes/cabinet

0.0 2.0 0.0 303 KB

File Storage Services for .NET

License: MIT License

PowerShell 1.04% C# 97.74% HTML 0.36% JavaScript 0.86%

cabinet's Introduction

Cabinet

Build status Coverage Status

Cabinet provides abstractions over various file storage providers. This allows you to develop IO code without having to worry about where the file is actually stored.

Plugging in a new provider is easy as:

cabinetFactory.RegisterFileSystemProvider()

and

IFileCabinet fileCabinet = cabinetFactory.GetCabinet(new FileSystemCabinetConfig() {
    Directory = @"C:\data\"
});

The project has Core packages and Provider packages. Core packages provide abstractions and helpers.

Core Packages Version
Core Cabinet.Core Nuget Version
Config Cabinet.Config Nuget Version
Web Cabinet.Web Nuget Version

We current support the following providers

Provider Provider Package Config Package
File System Cabinet.FileSystem Nuget Version Cabinet.FileSystem.Config Nuget Version
Migrator Cabinet.Migrator Nuget Version Cabinet.Migrator.Config Nuget Version
Amazon S3 Cabinet.S3 Nuget Version Cabinet.S3.Config Nuget Version
Azure Blog TODO TODO
Google Cloud Storage TODO TODO

Getting Started with Cabinet

Cabinet is designed to be very configurable and pluggable.

IFileCabinetFactory cabinetFactory = new FileCabinetFactory(); // or inject IFileCabinetFactory with IOC

cabinetFactory
    .RegisterFileSystemProvider() // Register a file system provider to store files on disk
    .RegisterS3Provider(); // Register an Amazon S3 provider

IFileCabinet fileCabinet = cabinetFactory.GetCabinet(new FileSystemCabinetConfig() {
    Directory = @"C:\data\"
});

IFileCabinet s3Cabinet = cabinetFactory.GetCabinet(new S3CabinetConfig() {
    AWSCredentials = new BasicAWSCredentials("accessKey", "secretKey"), 
    AmazonS3Config = new AmazonS3Config(),
    BucketName = "test-bucket"
});

string fileKey = "foo/bar.txt";

using (var stream = await s3Cabinet.OpenReadStreamAsync(fileKey)) { // open stream for file in s3
    ISaveResult saveResult = await fileCabinet.SaveFileAsync(fileKey, stream, HandleExistingMethod.Overwrite); // save file to disk
}

Questions or Problems?

Open an issue

Contributions

Yes please. Please open an issue before before sending a pull requests. All changes need to be discussed before they are accepted.

License

MIT

cabinet's People

Contributors

johncmckim avatar

Watchers

 avatar  avatar

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.