Galosys.Foundation.LocalFileSystem
26.7.31.1
dotnet add package Galosys.Foundation.LocalFileSystem --version 26.7.31.1
NuGet\Install-Package Galosys.Foundation.LocalFileSystem -Version 26.7.31.1
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="Galosys.Foundation.LocalFileSystem" Version="26.7.31.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Galosys.Foundation.LocalFileSystem" Version="26.7.31.1" />
<PackageReference Include="Galosys.Foundation.LocalFileSystem" />
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 Galosys.Foundation.LocalFileSystem --version 26.7.31.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Galosys.Foundation.LocalFileSystem, 26.7.31.1"
#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 Galosys.Foundation.LocalFileSystem@26.7.31.1
#: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=Galosys.Foundation.LocalFileSystem&version=26.7.31.1
#tool nuget:?package=Galosys.Foundation.LocalFileSystem&version=26.7.31.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Galosys.Foundation.LocalFileSystem
🟡 实验性 — 本地文件系统存储适配器,实现
IFileStorageProvider接口,适用于开发环境和单机部署。
快速开始
// Program.cs / Startup.cs — 最小化配置(使用默认路径 ./uploads)
services.AddLocalFileSystem();
从配置文件绑定:
services.AddLocalFileSystem(configuration);
配置
// appsettings.json
{
"LocalFileSystem": {
"BasePath": "./uploads" // 文件存储根目录,默认 "./uploads"
}
}
使用示例
var provider = serviceProvider.GetRequiredService<IFileStorageProvider>();
// Upload — 文件写入本地磁盘
var result = await provider.UploadAsync(stream, "docs/report.pdf");
// Download — 从本地磁盘读取
var stream = await provider.DownloadAsync("docs/report.pdf");
// GetPresignedUrl — 返回物理文件路径(本地无预签名 URL)
var path = await provider.GetPresignedUrlAsync("docs/report.pdf");
// Delete — 删除本地文件
await provider.DeleteAsync("docs/report.pdf");
// 使用子目录(bucket 参数映射为子目录)
await provider.UploadAsync(stream, "photo.jpg", bucket: "images");
// 文件保存到: ./uploads/images/photo.jpg
主要类型
| 类型 | 说明 |
|---|---|
LocalFileSystemStorageProvider |
IFileStorageProvider 实现,ProviderName = "local" |
LocalFileSystemOptions |
配置选项,BasePath 默认 "./uploads" |
LocalFileSystemModule |
IModule 模块入口 |
LocalFileSystemServiceCollectionExtensions |
AddLocalFileSystem() DI 扩展方法 |
注意事项
- 适用于开发环境和单机部署场景,分布式环境请使用对象存储适配器
GetPresignedUrlAsync返回物理路径而非 HTTP URLbucket参数映射为BasePath下的子目录- 线程安全,支持并发读写
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Galosys.Foundation.Core (>= 26.7.31.1)
- Galosys.Foundation.FileStorage (>= 26.7.31.1)
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 |
|---|---|---|
| 26.7.31.1 | 0 | 7/31/2026 |
| 26.7.30.1 | 30 | 7/30/2026 |
| 26.7.29.1 | 35 | 7/29/2026 |
| 26.7.28.1 | 53 | 7/28/2026 |
| 26.7.26.2 | 87 | 7/26/2026 |
| 26.7.26.1 | 80 | 7/25/2026 |
| 26.7.25.1 | 88 | 7/25/2026 |
| 26.7.24.2 | 86 | 7/24/2026 |
| 26.7.24.1 | 85 | 7/24/2026 |
| 26.7.22.1 | 86 | 7/23/2026 |
| 26.7.21.1 | 90 | 7/22/2026 |
| 26.7.20.2 | 82 | 7/20/2026 |
| 26.7.20.1 | 82 | 7/20/2026 |
| 26.7.19.3 | 87 | 7/19/2026 |
| 26.7.19.2 | 83 | 7/19/2026 |
| 26.7.19.1 | 85 | 7/19/2026 |
| 26.7.18.2 | 88 | 7/18/2026 |
| 26.7.18.1 | 87 | 7/18/2026 |
| 26.7.14.1 | 99 | 7/14/2026 |
| 26.7.13.1 | 80 | 7/13/2026 |
Loading failed