Cloud.File.Storage.Manager.Physical
2.1.0
dotnet add package Cloud.File.Storage.Manager.Physical --version 2.1.0
NuGet\Install-Package Cloud.File.Storage.Manager.Physical -Version 2.1.0
<PackageReference Include="Cloud.File.Storage.Manager.Physical" Version="2.1.0" />
<PackageVersion Include="Cloud.File.Storage.Manager.Physical" Version="2.1.0" />
<PackageReference Include="Cloud.File.Storage.Manager.Physical" />
paket add Cloud.File.Storage.Manager.Physical --version 2.1.0
#r "nuget: Cloud.File.Storage.Manager.Physical, 2.1.0"
#:package Cloud.File.Storage.Manager.Physical@2.1.0
#addin nuget:?package=Cloud.File.Storage.Manager.Physical&version=2.1.0
#tool nuget:?package=Cloud.File.Storage.Manager.Physical&version=2.1.0
Cloud File Storage Manager
Provides complete implementation to handle easily cloud file storage operations like get informations about files, reading, downloadURL generation, file update, file move and delete. Primarily for Physical right now.
Configuration
Let's add a section to the appsettings.json
"PhysicalStorageSettings": {
"RootDirectoryPath": "",
"AllowLinks": false
}
In the application, configure this settings part
services.AddSingleton<ICloudFileStorageManager, PhysicalFileStorage>(services => new PhysicalFileStorage(new PhysicalFileStorageOptions()
{
RootDirectoryPath = config.GetSection("PhysicalStorageSettings").GetValue<string>("RootDirectoryPath"),
AllowLinks = config.GetSection("PhysicalStorageSettings").GetValue<bool>("AllowLinks")
}));
RootDirectoryPath: the folder that holds the files. A relative path is resolved against the current directory.AllowLinks: false by default. Symbolic links and junctions inside the root are then refused; the root folder itself may be a link. Set it to true to follow links inside the root.
Behaviour
- Every path stays inside the root folder; a path that resolves outside it is rejected with an
ArgumentException. - On top of the common path rules, segments with
:, segments ending in a dot or a space, and Windows reserved device names (such asCON,NUL,COM1orLPT1, with or without an extension) are rejected on every platform. - Reading a missing file, or opening a read-only local stream on it, throws a
FileNotFoundException. - The root folder cannot be deleted or modified.
- Moving a file creates the target folder when it does not exist.
- Download URLs are not supported:
SupportsDownloadUrlis false and the download URL methods throw aNotSupportedException. - The physical path of a file and the file name of a
FileNotFoundExceptioncontain the full server path, so do not show them to end users.
| 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. |
-
net8.0
- Cloud.File.Storage.Manager.Common (>= 3.1.0)
- Microsoft.Extensions.FileProviders.Physical (>= 8.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.
- Reading a missing file throws FileNotFoundException instead of creating an empty file
- Paths are kept inside the root directory; names with a colon, Windows device names and names ending in a dot or space are rejected
- Symbolic links and junctions below the root are refused unless AllowLinks is set
- Writeable local file streams no longer try to re-upload into their own file on dispose
- Move creates the target folder
- Update Cloud.File.Storage.Manager.Common 3.0.0 -> 3.1.0