Interface IFileProvider
Represents an object that can provide files and/or directories to be served by a FileModule.
Namespace: EmbedIO.Files
Syntax
public interface IFileProvider
Properties
IsImmutable
Gets a value indicating whether the files and directories provided by this instance will never change.
Declaration
bool IsImmutable { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
GetDirectoryEntries(String, IMimeTypeProvider)
Returns an enumeration of the entries of a directory.
Declaration
IEnumerable<MappedResourceInfo> GetDirectoryEntries(string providerPath, IMimeTypeProvider mimeTypeProvider)
Parameters
Type | Name | Description |
---|---|---|
String | providerPath | The provider-specific path for the directory. |
IMimeTypeProvider | mimeTypeProvider | An IMimeTypeProvider interface to use for determining the MIME type of files. |
Returns
Type | Description |
---|---|
IEnumerable<MappedResourceInfo> | An enumeration of MappedResourceInfo objects identifying the entries
in the directory identified by |
MapUrlPath(String, IMimeTypeProvider)
Maps a URL path to a provider-specific path.
Declaration
MappedResourceInfo MapUrlPath(string path, IMimeTypeProvider mimeTypeProvider)
Parameters
Type | Name | Description |
---|---|---|
String | path | The URL path. |
IMimeTypeProvider | mimeTypeProvider | An IMimeTypeProvider interface to use for determining the MIME type of a file. |
Returns
Type | Description |
---|---|
MappedResourceInfo | A provider-specific path identifying a file or directory,
or null if this instance cannot provide a resource associated
to |
OpenFile(String)
Opens a file for reading.
Declaration
Stream OpenFile(string providerPath)
Parameters
Type | Name | Description |
---|---|---|
String | providerPath | The provider-specific path for the file. |
Returns
Type | Description |
---|---|
Stream | A readable |
Start(CancellationToken)
Signals a file provider that the web server is starting.
Declaration
void Start(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A |
Events
ResourceChanged
Occurs when a file or directory provided by this instance is modified or removed.
The event's parameter is the provider-specific path of the resource that changed.
Declaration
event Action<string>? ResourceChanged
Event Type
Type | Description |
---|---|
Nullable<Action<String>> |