WopiHost.FileSystemProvider
6.0.0
See the version list below for details.
dotnet add package WopiHost.FileSystemProvider --version 6.0.0
NuGet\Install-Package WopiHost.FileSystemProvider -Version 6.0.0
<PackageReference Include="WopiHost.FileSystemProvider" Version="6.0.0" />
<PackageVersion Include="WopiHost.FileSystemProvider" Version="6.0.0" />
<PackageReference Include="WopiHost.FileSystemProvider" />
paket add WopiHost.FileSystemProvider --version 6.0.0
#r "nuget: WopiHost.FileSystemProvider, 6.0.0"
#:package WopiHost.FileSystemProvider@6.0.0
#addin nuget:?package=WopiHost.FileSystemProvider&version=6.0.0
#tool nuget:?package=WopiHost.FileSystemProvider&version=6.0.0
WopiHost.FileSystemProvider
Reference implementation of IWopiStorageProvider and IWopiWritableStorageProvider backed by a local directory tree. Identifiers are short opaque strings cached in-memory and mapped to absolute paths.
Suitable for development, validator runs, and single-instance deployments. Storage only — token issuance and ACLs live in WopiHost.Core.
Install
dotnet add package WopiHost.FileSystemProvider
Configure
// appsettings.json
"Wopi": {
"StorageProviderAssemblyName": "WopiHost.FileSystemProvider",
"StorageProvider": {
"RootPath": "./wopi-docs" // absolute or relative to ContentRootPath
}
}
RootPath is bound from the Wopi:StorageProvider section (WopiConfigurationSections.STORAGE_OPTIONS).
Register
builder.Services.AddSingleton<InMemoryFileIds>();
builder.Services.AddScoped<IWopiStorageProvider, WopiFileSystemProvider>();
builder.Services.AddScoped<IWopiWritableStorageProvider, WopiFileSystemProvider>();
builder.Services.AddWopi(o =>
{
o.ClientUrl = new Uri("https://your-office-online-server.com");
o.StorageProviderAssemblyName = "WopiHost.FileSystemProvider";
});
If you use the sample's assembly-name loader (AddStorageProvider), the two AddScoped lines are not needed — the sample reflectively scans the assembly and registers anything that implements IWopiStorageProvider / IWopiWritableStorageProvider. See sample/WopiHost/Program.cs.
How identifiers work
Identifiers are short tokens generated by InMemoryFileIds on first scan and reused for the lifetime of the process. They are NOT base64-encoded paths; consumers should treat them as opaque strings. Lookup is O(1) in both directions; the cache is rebuilt at startup if RootPath changes.
A consequence of this design: identifiers are stable within a process but not across restarts. Persist your own mapping if you need long-lived URLs.
Customize
To layer behavior — versioning, audit, soft-delete — wrap the provider via composition. The concrete class' interface methods are non-virtual, so a decorator is the cleanest seam:
public class AuditingStorageProvider(IWopiWritableStorageProvider inner, IAuditLog audit)
: IWopiWritableStorageProvider
{
public Task<bool> DeleteWopiResource<T>(string id, CancellationToken ct = default)
where T : class, IWopiResource
{
var deleted = inner.DeleteWopiResource<T>(id, ct);
_ = deleted.ContinueWith(t => { if (t.Result) audit.Log($"deleted {id}"); }, ct);
return deleted;
}
// Forward the rest of IWopiWritableStorageProvider to `inner`.
public int FileNameMaxLength => inner.FileNameMaxLength;
// ...
}
License
See the repo README.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.3)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.3)
- System.IO.FileSystem.AccessControl (>= 5.0.0)
- WopiHost.Abstractions (>= 6.0.0)
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.7)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.7)
- WopiHost.Abstractions (>= 6.0.0)
-
net9.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.7)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.7)
- WopiHost.Abstractions (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.