Galosys.Foundation.LocalFileSystem
26.5.20.1
dotnet add package Galosys.Foundation.LocalFileSystem --version 26.5.20.1
NuGet\Install-Package Galosys.Foundation.LocalFileSystem -Version 26.5.20.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.5.20.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.5.20.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.5.20.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Galosys.Foundation.LocalFileSystem, 26.5.20.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.5.20.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.5.20.1
#tool nuget:?package=Galosys.Foundation.LocalFileSystem&version=26.5.20.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 | 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 was computed. 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 was computed. 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.
-
net8.0
- Galosys.Foundation.Core (>= 26.5.20.1)
- Galosys.Foundation.FileStorage (>= 26.5.20.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.5.20.1 | 95 | 5/20/2026 |
| 26.5.19.1 | 94 | 5/19/2026 |
| 26.5.18.1 | 88 | 5/18/2026 |
| 26.5.15.1 | 89 | 5/15/2026 |
| 26.5.12.3 | 89 | 5/12/2026 |
| 26.5.12.2 | 91 | 5/12/2026 |
| 26.4.27.1-rc1 | 95 | 4/26/2026 |
| 26.4.25.1-rc1 | 90 | 4/25/2026 |
| 26.4.22.2-rc7 | 96 | 4/22/2026 |
| 26.4.22.2-rc6 | 92 | 4/22/2026 |
| 26.4.22.2-rc4 | 100 | 4/22/2026 |
| 26.4.22.2-rc3 | 88 | 4/22/2026 |
| 26.4.19.1-rc1 | 100 | 4/19/2026 |