Resourcefull 3.1.0
dotnet add package Resourcefull --version 3.1.0
NuGet\Install-Package Resourcefull -Version 3.1.0
<PackageReference Include="Resourcefull" Version="3.1.0" />
<PackageVersion Include="Resourcefull" Version="3.1.0" />
<PackageReference Include="Resourcefull" />
paket add Resourcefull --version 3.1.0
#r "nuget: Resourcefull, 3.1.0"
#:package Resourcefull@3.1.0
#addin nuget:?package=Resourcefull&version=3.1.0
#tool nuget:?package=Resourcefull&version=3.1.0
Resourcefull
Resourcefull stores and serves files of any type and size from infrastructure you run yourself. Upload, download, list and version resources in named containers through one client API, and keep the bytes in SQL Server, in memory for tests, or in a storage provider of your own.
| Package | What it's for |
|---|---|
Resourcefull |
The clients and the provider interface. |
Resourcefull.SqlServer |
Stores resources in SQL Server. |
Resourcefull.InMemory |
Keeps resources in process memory, for tests and local development. |
Resourcefull.AspNetCore |
Serves downloads and accepts uploads in ASP.NET Core, with conditional requests and status codes. |
Features
- Any size: uploads and downloads stream, so memory use stays flat whatever the file size.
- Versioning: keep up to N versions of each resource, list them, download any of them, and restore an older one.
- Integrity: every version records its length and SHA-256 hash, measured as it's written. An upload whose declared length doesn't match its content is rejected, and nothing is stored.
- Safe under concurrency: each name always has exactly one current version, and create-only uploads can't overwrite each other.
- Your own storage: implement
IResourceRepositoryand register it withUseProvider.
Quick start
dotnet add package Resourcefull
dotnet add package Resourcefull.SqlServer # or Resourcefull.InMemory
Register Resourcefull with a provider, and provision the database:
builder.Services.AddResourcefull(options => options
.UseSqlServer(builder.Configuration.GetConnectionString("Resources")!)
.UseVersioning(maxVersions: 10));
var app = builder.Build();
await app.Services.MigrateResourcefullDatabaseAsync();
Then use IResourceServiceClient for containers, and a container client for the resources in one:
public class Reports(IResourceServiceClient resources)
{
public async Task<ResourceInfo> SaveAsync(string name, Stream content)
{
IResourceContainerClient reports = await resources.CreateResourceContainerIfNotExistsAsync("reports");
return await reports.UploadAsync(name, content, new ResourceUploadOptions
{
Overwrite = true,
Headers = new ResourceHeaders("application/pdf", null)
});
}
public async Task<ResourceDownloadResult?> OpenAsync(string name)
=> await resources.GetResourceContainerClient("reports").DownloadStreamingAsync(name);
}
Documentation
The documentation site has everything below, plus the API reference.
- Getting started
- Concepts: containers and names, uploads and downloads, versioning, concurrency, errors
- SQL Server: provisioning, permissions and upgrades
- ASP.NET Core
- Upgrading to 3.0 and the changelog
- All documentation
Contributing
See CONTRIBUTING.md.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Options (>= 10.0.14)
- System.Memory.Data (>= 10.0.14)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Resourcefull:
| Package | Downloads |
|---|---|
|
Resourcefull.InMemory
In-memory storage for Resourcefull, for tests and local development. Not for production: everything is held in process memory and lost when the process ends. |
|
|
Resourcefull.SqlServer
SQL Server storage for Resourcefull: streams content in chunks with bounded memory, keeps versions and content hashes, and ships idempotent provisioning and upgrade scripts. |
|
|
Resourcefull.AspNetCore
ASP.NET Core support for Resourcefull: serve downloads with their headers and conditional responses, accept uploads with the request's preconditions, and turn Resourcefull's exceptions into status codes. |
GitHub repositories
This package is not used by any popular GitHub repositories.