Netigent.Utils.FileStoreIO 1.4.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Netigent.Utils.FileStoreIO --version 1.4.3
                    
NuGet\Install-Package Netigent.Utils.FileStoreIO -Version 1.4.3
                    
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="Netigent.Utils.FileStoreIO" Version="1.4.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Netigent.Utils.FileStoreIO" Version="1.4.3" />
                    
Directory.Packages.props
<PackageReference Include="Netigent.Utils.FileStoreIO" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Netigent.Utils.FileStoreIO --version 1.4.3
                    
#r "nuget: Netigent.Utils.FileStoreIO, 1.4.3"
                    
#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.
#:package Netigent.Utils.FileStoreIO@1.4.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Netigent.Utils.FileStoreIO&version=1.4.3
                    
Install as a Cake Addin
#tool nuget:?package=Netigent.Utils.FileStoreIO&version=1.4.3
                    
Install as a Cake Tool

FileStoreIOClient

License NuGet GitHub stars

A generic layer to allow the saving and loading of files from configurable stores using a unique fileRef with prefix code for detection in your code.
Supports UNC (FileSystem), Database, Box, and AWS S3 Buckets.

License

This library is licensed under the Apache License 2.0.

  • Full commercial use is allowed (including in closed-source products, SaaS, or sold software — no royalties or source-sharing required).
  • Explicit patent grant from contributors for any patents necessarily infringed by their contributions.
  • Strong disclaimers: Provided "AS IS", WITHOUT WARRANTIES of any kind (express or implied). Use at your own risk — no liability for any damages.
  • Full license text: LICENSE (in the repository root).

Contributions you make are automatically licensed under the same Apache 2.0 terms.

How to Use

Thanks for considering this library — we hope it saves you time and simplifies file handling!

The library supports multiple storage providers (Database, FileSystem/UNC, Box, AWS S3) and uses a consistent fileRef (e.g., _$uniqueid) for all operations.

Database Notes

The library auto-creates and upgrades the FileStoreIndex table in the specified schema.
You can safely drop unused legacy columns: [FileType], [MainGroup], [SubGroup], [PathTags] — they are no longer used.

Quick Start

Direct Usage (keeping last 3 versions)

// Example configuration objects (use your real values!)
var myBoxConfig = new BoxConfig { /* ... your Box settings ... */ };
var myS3Config  = new S3Config  { /* ... your S3 settings ... */ };
var myFsConfig  = new FileSystemConfig { RootFolder = @"C:\temp\Files\", StoreFileAsUniqueRef = false };

var fileStoreIOClient = new FileStoreIOClient(
    appPrefix: "MyApp",
    databaseConnection: "Server=.;Database=myDb;Trusted_Connection=True;",
    maxVersions: 3,
    dbSchema: "filestore",
    defaultFileStore: FileStorageProvider.FileSystem,  // or S3, Database, Box
    boxConfig: myBoxConfig,
    s3Config: myS3Config,
    fileSystemConfig: myFsConfig);

// Example: Get a file by ref
var file = await fileStoreIOClient.File_GetAsyncV2("_$23fe627c5a5b410aa6017db308b71077");

appSettings.json example (keeping last 5 versions)

"FileStoreIO": {
  "Database": "Server=.;Database=myDatabase;UID=mySa;PWD=myPassword;",
  "AppPrefix": "MyAppToScopeTo",
  "FilePrefix": "_$",
  "DatabaseSchema": "filestore",
  "MaxVersions": 5,
  "DefaultStorage": "S3",
  "S3": {
    "AccessKey": "ExampleAccessKey",
    "SecretKey": "mysecretkeyinhere+",
    "Region": "us-west-2",
    "BucketName": "my-example-bucket-name"
  },
  "Box": {
    "EnterpriseID": "123456789",
    "AutoCreateRoot": false,
    "TimeoutInMins": 15,
    "BoxAppSettings": {
      "ClientID": "exampleid12345",
      "ClientSecret": "examplesecret12345",
      "AppAuth": {
        "Passphrase": "examplepassphrase12345",
        "PrivateKey": "-----BEGIN ENCRYPTED PRIVATE KEY-----\nEXAMPLEEXAMPLEEXAMPLE\n-----END ENCRYPTED PRIVATE KEY-----\n",
        "PublicKeyID": "abc1234"
      }
    }
  },
  "FileSystem": {
    "RootFolder": "c:\\temp\\files\\",
    "StoreFileAsUniqueRef": false
  }
}

Registering in Startup.cs

public void ConfigureServices(IServiceCollection services)
{
    // Inject FileStoreIOClient provider
    services.Configure<FileStoreIOConfig>(Configuration.GetSection(FileStoreIOConfig.Section));
    services.AddSingleton<Netigent.Utils.FileStoreIO.IFileStoreIOClient, FileStoreIOClient>();
}

Usage in a Controller Example

using Netigent.Examples.UploadApp.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Netigent.Utils.FileStoreIO;
using Netigent.Utils.FileStoreIO.Enums;
using System.Threading.Tasks;

namespace Netigent.Examples.UploadApp.Controllers
{
    public class HomeController : Controller
    {
        private readonly IFileStoreIOClient _ioClient;

        public HomeController(IFileStoreIOClient fileStoreIOClient)
        {
            _ioClient = fileStoreIOClient;
        }

        public async Task<IActionResult> Index()
        {
            ViewBag.Message = TempData["Message"];
            return View(new FileUploadViewModel { Files = await _ioClient.Files_GetAll() });
        }

        [HttpPost]
        [ActionName("Upload")]
        public async Task<IActionResult> Upload(IFormFile selectedFile, string location = "database", string description = "", string customerCode = "", string itemType = "")
        {
            var uploadLocation = (location ?? "").Equals("Database", StringComparison.CurrentCultureIgnoreCase)
                ? FileStorageProvider.Database
                : FileStorageProvider.FileSystem;

            var uploadedCode = await _ioClient.File_UpsertAsync(selectedFile, uploadLocation, description: description, customerCode, itemType);

            TempData["Message"] = $"File successfully uploaded to {uploadLocation} {uploadedCode}";

            // Setting success properties
            TempData["FileId"] = uploadedCode;
            TempData["FileLink"] = $"https://localhost:44317/Home/GetFile/{uploadedCode}";

            // Example: render dynamic images from FileStoreIOClient
            // e.g. <img src="@TempData["FileLink"]" style="height: 100px; width: auto;" />

            return RedirectToAction("Index");
        }

        public async Task<IActionResult> GetFile(string id)
        {
            var file = await _ioClient.File_Get(id);
            if (file == null) return NotFound();

            return File(file.Data, file.ContentType, file.Name);
        }

        public async Task<IActionResult> DeleteFile(string id)
        {
            // var xyz = await something();  // Remove or replace placeholder
            var fileInfo = await _ioClient.File_DeleteAsync(id);
            return RedirectToAction("Index");
        }
    }
}

Version History Highlights

1.4.3
Fixed License link in README.

1.4.2
Added MimeType helper for SVG = image/svg+xml (see changes in 1.4.0).

1.4.1
Bug fix on absolute paths in FileSystem storage (see changes in 1.4.0).

1.4.0

  • Marked old methods as obsolete:
    List<InternalFileModel> Files_GetAllV2(string[] pathTags, bool recursiveSearch = false);
    List<InternalFileModel> Files_GetAllV2(string relationalFilePathAndName, bool recursiveSearch = false);
    
    Use these clearer alternatives instead:
    List<FileStoreItem> Files_GetByFolder(string folderPath, bool includeSubFolders = false);
    List<FileStoreItem> Files_GetByFileAndFolder(string folderPath, bool includeSubFolders, string fileToFind, bool exactFileMatch);
    
  • Removed Microsoft.AspNetCore.Http.Features dependency (Upsert methods for IFormFile removed — use byte[] directly):
    IFormFile myFile = ...;  // from HttpRequest
    
    using var dataStream = new MemoryStream();
    await myFile.CopyToAsync(dataStream);
    string fileRef = await fileStoreIOClient.File_UpsertAsyncV2("HT/Training/myprocedures.pdf", dataStream.ToArray());
    
  • Renamed models for clarity:
    FileObjectModelFileOutput (simple output for sending to clients)
    InternalFileModelFileStoreItem (full record from FileStoreIndex table)
  • FileStoreIndex table now uses Folder column (PathTags deprecated but kept for reference).

1.3.0
Added support for relocating files:

Task<ResultModel> File_MoveAsync(string fileRef, string[] pathTags);
Task<ResultModel> File_MoveAsync(string fileRef, string relationalFilePathAndName);

1.2.1
Bug fix: Subfile replaced by single Parent. RecursiveSearch = false is now default.

1.2.0
Added recursive flag to Files_GetAllV2. Removed obsolete legacy methods.

1.1.7
Bug fix for AppPrefix not populating correctly. Upgraded to .NET 8.0 LTS + package updates.

1.1.6
Database migration: Include AppPrefix in PathTags (run this SQL if files "disappeared" after v1.1.5):

UPDATE {schema}.[FileStoreIndex] 
SET PathTags = '{AppPrefix}/' + PathTags 
WHERE PathTags NOT LIKE '{AppPrefix}%';

1.1.5
README updates and stabilization.

1.1.4
Internal database upgrade.

1.1.3
Added README.md to NuGet package.

(Older versions omitted for brevity — see commit history for full details.)

Contributing

Contributions are very welcome — from individuals, companies, bug hunters, feature requesters, and documentation helpers alike!

This project uses Apache 2.0 with an explicit patent grant, so companies can contribute safely with mutual patent protection.

How to contribute:

  1. Fork https://github.com/netigent/file-store-io
  2. Create a branch: git checkout -b feature/my-cool-change
  3. Make your changes + add tests if possible
  4. Push and open a Pull Request

We especially appreciate:

  • Support for new storage providers
  • Performance improvements
  • Better error handling / logging
  • Documentation / examples
  • Bug fixes

Open an issue first for big changes or questions.
Thanks in advance — your help makes this library better for everyone!

Questions / Issues

Found a bug? Have a feature idea?
→ Open an issue here: https://github.com/netigent/file-store-io/issues

Enjoy using FileStoreIOClient!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.4.4 126 1/31/2026
1.4.3 114 1/23/2026
1.4.2 102 1/23/2026
1.4.1 228 12/5/2025
1.4.0 207 11/27/2025
1.3.1 215 10/28/2025
1.3.0 297 8/6/2025
1.2.1 312 5/20/2025
1.2.0 207 1/24/2025
1.1.7 180 1/23/2025
1.1.6 272 2/17/2024
1.1.5 239 2/15/2024
1.1.4 203 2/15/2024
1.1.3 208 2/15/2024
1.1.2 210 2/15/2024
1.1.1 217 2/15/2024
1.0.14 1,619 6/2/2023
1.0.13 342 3/30/2023
1.0.12 328 3/30/2023
1.0.11 367 3/16/2023
Loading failed

Switched license to Apache 2.0 (explicit patent grant, stronger disclaimers). See README for full changelog and contribution guidelines.