Acrobit.AcroFS 1.0.3.51200

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

// Install Acrobit.AcroFS as a Cake Tool
#tool nuget:?package=Acrobit.AcroFS&version=1.0.3.51200

Cross-platform, small and super fast file-based storage library

AcroFS is a very small, cross-platform and super fast file system based storage library that can manage huge amounts of files on your file system


// defining the store
var _storage = FileStore.GetStore("c:\\store1");

// store
var docId = _storage.Store(data);

// load
var data = _storage.Load(docId);

Features

  • Generates unique ids as integer
  • Multiple Storage
  • Sub Storages
  • GZip Compression / Decompression for text files
  • Store/Load Texts and Streams
  • Store/Load Attachments related to a doc
  • .Net Core / Mono / Linux / Mac Support

Download

NuGet version

How it works

It keeps the last ID in memory and generates new ones by a simple atomic +1 operation and so it's very fast. It converts a doc id into a hex number and stores it as 4 hirarchy folders

StorageRoot\12\31\26\5A\17

The last hex number ( in this example 17 ) is the stored file.

You can assign attachments to a file. they are stored as Filename[-]AttachName

For example, two attachment files are assigned to documentId 17 as following file names:

StorageRoot\...\17
            ...\17-attachmentFile1
            ...\17-attachmentFile2

File Storage Examples

  • Storing / Loading Texts :
// defining the store
var _storage = FileStore.GetStore("c:\\store1");

// store    
long docId = _storage.StoreText("the content");

// load
Assert.Equal("the content", _storage.LoadText(docId));

<br/>

  • Working with Streams :
// store    
long docId = _storage.Store(theStream);

// load
var myStream = _storage.Load(docId));

<br/>

  • Attachments :
// create doc
long docId = _storage.StoreText("the content");

// store two attachments
_storage.AttachText(docId, "attach-name-1", "attachment content 1");
_storage.AttachText(docId, "attach-name-2", "attachment content 2");

// load all attachments as list of strings
IList<string> attachs = _storage.LoadTextAttachs(docId);

// load all attachments as list of streams
IList<Stream> attachs = _storage.LoadAttachs(docId);

// load "attach-name-1" 
string myAttachmentText = _storage.LoadTextAttach(docId, "attach-name-1");

<br/>

  • GZip Compresion for Texts :
// store    
long docId = _storage.StoreText("a large text", 
    options: StoreOptions.Compress);

// load
var myText = _storage.LoadText(docId, 
    options: LoadOptions.Decompress);

<br/>

  • Sub Storages
//  creating news docs
long newsId1 = _storage.StoreText("news content 1", "news");
long newsId2 = _storage.StoreText("news content 2", "news");

//  creating articles docs
long articleId1 = _storage.StoreText("article content 1", "article");
long articleId2 = _storage.StoreText("article content 2", "article");

//  loading
Assert.Equal("news content 1", _storage.LoadText(newsId1, "news"));
Assert.Equal("article content 2", _storage.LoadText(articleId2, "article"));


The output File System :

StorageRoot\news\...\01
                 ...\02

StorageRoot\article\...\01
                    ...\02
Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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
2.1.19 729 6/14/2023
2.1.18 145 5/29/2023
2.1.17 138 5/21/2023
2.1.16 1,196 12/30/2022
2.1.15 271 12/30/2022
2.1.14 1,014 11/19/2021
2.1.13 328 11/17/2021
2.1.12 325 11/17/2021
2.1.11 314 11/17/2021
2.1.10 313 11/17/2021
2.1.4 294 11/15/2021
2.1.3 285 11/14/2021
2.1.2 341 11/14/2021
2.1.1 337 9/27/2021
1.0.3.51200 1,008 7/23/2018