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
                    
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="Cloud.File.Storage.Manager.Physical" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cloud.File.Storage.Manager.Physical" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Cloud.File.Storage.Manager.Physical" />
                    
Project file
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 Cloud.File.Storage.Manager.Physical --version 2.1.0
                    
#r "nuget: Cloud.File.Storage.Manager.Physical, 2.1.0"
                    
#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 Cloud.File.Storage.Manager.Physical@2.1.0
                    
#: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=Cloud.File.Storage.Manager.Physical&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Cloud.File.Storage.Manager.Physical&version=2.1.0
                    
Install as a Cake Tool

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 as CON, NUL, COM1 or LPT1, 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: SupportsDownloadUrl is false and the download URL methods throw a NotSupportedException.
  • The physical path of a file and the file name of a FileNotFoundException contain the full server path, so do not show them to end users.
Product 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.

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
2.1.0 104 10/10/2026
2.0.0 420 2/5/2024
1.0.0 345 5/20/2023

- 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