Disk
Description
For local development, single-node deployments, or simple on-prem scenarios, you can back IFlexFileStore with the local filesystem using LocalFileStore.
Important concepts
LocalFileStoreis a core implementation: it lives inSumeru.Flex.Coreand does not require a cloud SDK.Base path scoping: all operations are relative to a configured
BasePath.Permissions matter: the host process must have read/write access to the base directory.
Configuration in DI
Unlike cloud providers, LocalFileStore is wired directly (there isn’t a generated AddFlex...FileStore(...) extension for it).
Add this in your DI composition root (commonly EndPoints/...CommonConfigs/OtherApplicationServicesConfig.cs).
using Sumeru.Flex;
using Microsoft.Extensions.Options;
public static class OtherApplicationServicesConfig
{
public static IServiceCollection AddOtherApplicationServices(
this IServiceCollection services,
IConfiguration configuration)
{
services.Configure<LocalFileStoreOptions>(
configuration.GetSection("FlexBase:DataStores:File:LocalFileSystem"));
services.AddSingleton<IFlexFileStore>(sp =>
{
var options = sp.GetRequiredService<IOptions<LocalFileStoreOptions>>().Value;
return new LocalFileStore(options);
});
return services;
}
}appsettings.json
You can choose any section name; this example uses FlexBase:DataStores:File:LocalFileSystem.
Examples (template-based)
These examples mirror the generated Query and PostBusHandler templates. You do not register these types manually—Flex discovers and wires generated Queries/Handlers automatically.
Upload file (PostBusHandler)
Download file (Query)
Library-specific considerations
Path + permissions: pick an absolute
BasePathand ensure the app identity can read/write.Multi-instance: local disk is not shared across nodes; use a cloud provider if you need horizontal scale.
Last updated