PhysicalFileProvider Class¶
Looks up files using the on-disk file system
- Namespace
Microsoft.Extensions.FileProviders
- Assemblies
- Microsoft.Extensions.FileProviders.Physical
Syntax¶
public class PhysicalFileProvider : IFileProvider, IDisposable
-
class
Microsoft.Extensions.FileProviders.
PhysicalFileProvider
Constructors¶
-
PhysicalFileProvider
(System.String)¶ Creates a new instance of a PhysicalFileProvider at the given root directory.
Arguments: root (System.String) – The root directory. This should be an absolute path. public PhysicalFileProvider(string root)
-
Methods¶
-
Dispose
()¶ public void Dispose()
-
GetDirectoryContents
(System.String)¶ Enumerate a directory at the given path, if any.
Arguments: subpath (System.String) – A path under the root directory Return type: Microsoft.Extensions.FileProviders.IDirectoryContents Returns: Contents of the directory. Caller must check Exists property. public IDirectoryContents GetDirectoryContents(string subpath)
-
GetFileInfo
(System.String)¶ Locate a file at the given path by directly mapping path segments to physical directories.
Arguments: subpath (System.String) – A path under the root directory Return type: Microsoft.Extensions.FileProviders.IFileInfo Returns: The file information. Caller must check Exists property. public IFileInfo GetFileInfo(string subpath)
-
Watch
(System.String)¶ Return type: Microsoft.Extensions.Primitives.IChangeToken public IChangeToken Watch(string filter)
-
Properties¶
-
Microsoft.Extensions.FileProviders.PhysicalFileProvider.
Root
¶ The root directory for this instance.
Return type: System.String public string Root { get; }
-