Skip to content

Commit b34dc7e

Browse files
eNeRGy164ViktorHofer
authored andcommitted
Provide Microsoft.Extentions.FileProviders.Physical package readme (#93485)
* Provide FileProviders.Physical package readme * Remove whitespace
1 parent cae670e commit b34dc7e

1 file changed

Lines changed: 35 additions & 9 deletions

File tree

  • src/libraries/Microsoft.Extensions.FileProviders.Physical/src

src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PACKAGE.md

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,69 @@
22

33
<!-- A description of the package and where one can find more documentation -->
44

5+
Provides an implementation of a physical file provider, facilitating file access and monitoring on the disk. The primary type, [`PhysicalFileProvider`](https://learn.microsoft.com/dotnet/api/microsoft.extensions.fileproviders.physicalfileprovider), enables the lookup of files on disk and can watch for changes either via `FileSystemWatcher` or polling mechanisms.
56

67

78
## Key Features
89

910
<!-- The key features of this package -->
1011

11-
*
12-
*
13-
*
12+
* Easy access and monitoring of files on the disk.
13+
* Ability to watch for file changes either by using `FileSystemWatcher` or through polling.
1414

1515
## How to Use
1616

1717
<!-- A compelling example on how to use this package with code, as well as any specific guidelines for when to use the package -->
1818

19+
This library can be used to look up files on disk and monitor file changes effectively.
20+
Below is an example of how to use the `PhysicalFileProvider` to access files on disk and monitor changes:
21+
22+
```c#
23+
using Microsoft.Extensions.FileProviders;
24+
using Microsoft.Extensions.FileProviders.Physical;
25+
26+
using var provider = new PhysicalFileProvider(AppContext.BaseDirectory);
27+
28+
Environment.SetEnvironmentVariable("DOTNET_USE_POLLING_FILE_WATCHER", "1");
29+
30+
var contents = provider.GetDirectoryContents(string.Empty);
31+
foreach (PhysicalFileInfo fileInfo in contents)
32+
{
33+
Console.WriteLine(fileInfo.PhysicalPath);
34+
}
35+
36+
var changeToken = provider.Watch("*.txt");
37+
changeToken.RegisterChangeCallback(_ => Console.WriteLine("Text file changed"), null);
38+
39+
Console.ReadLine();
40+
```
41+
1942
## Main Types
2043

2144
<!-- The main types provided in this library -->
2245

2346
The main types provided by this library are:
2447

25-
* ``
26-
* ``
27-
* ``
48+
* `Microsoft.Extensions.FileProviders.PhysicalFileProvider`
49+
* `Microsoft.Extensions.FileProviders.PhysicalDirectoryInfo`
50+
* `Microsoft.Extensions.FileProviders.PhysicalFileInfo`
2851

2952
## Additional Documentation
3053

3154
<!-- Links to further documentation. Remove conceptual documentation if not available for the library. -->
3255

33-
* [Conceptual documentation](https://learn.microsoft.com/en-us/dotnet/standard/serialization/**LIBRARYNAME**/overview)
34-
* [API documentation](https://learn.microsoft.com/en-us/dotnet/api/**LIBRARYNAME**)
56+
* [Conceptual documentation](https://learn.microsoft.com/aspnet/core/fundamentals/file-providers#physical-file-provider)
57+
* [API documentation](https://learn.microsoft.com/dotnet/api/microsoft.extensions.fileproviders.physical)
3558

3659
## Related Packages
3760

3861
<!-- The related packages associated with this package -->
3962

63+
* Abstractions of files and directories: [Microsoft.Extensions.FileProviders.Abstractions](https://www.nuget.org/packages/Microsoft.Extensions.FileProviders.Abstractions/)
64+
* File system globbing to find files matching a specified pattern: [Microsoft.Extensions.FileSystemGlobbing](https://www.nuget.org/packages/Microsoft.Extensions.FileSystemGlobbing/)
65+
4066
## Feedback & Contributing
4167

4268
<!-- How to provide feedback on this package and contribute to it -->
4369

44-
Microsoft.Extensions.FileProviders.Physical is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime).
70+
Microsoft.Extensions.FileProviders.Physical is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime).

0 commit comments

Comments
 (0)