Class FileProviderExtensions
Provides additional methods for Microsoft.Extensions.FileProviders.IFileProvider objects.
public static class FileProviderExtensions
- Inheritance
-
objectFileProviderExtensions
Methods
EnumerateFiles(IFileProvider, string, string, bool)
Returns an enumerable collection of file name in the directory.
public static IEnumerable<string> EnumerateFiles(this IFileProvider fileProvider, string basePath, string searchPattern, bool searchSubdirectories)
Parameters
fileProvider
IFileProviderThe Microsoft.Extensions.FileProviders.IFileProvider object.
basePath
stringThe directory to enumerate files.
searchPattern
stringThe search pattern to use in selecting files to enumeration.
searchSubdirectories
boolSpecifies whether to recursively enumerate subdirectories of
basePath
.
Returns
- IEnumerable<string>
EnumerateFiles(IFileProvider, string, Regex, bool)
Returns an enumerable collection of file name in the directory.
public static IEnumerable<string> EnumerateFiles(this IFileProvider fileProvider, string basePath, Regex pattern, bool searchSubdirectories)
Parameters
fileProvider
IFileProviderThe Microsoft.Extensions.FileProviders.IFileProvider object.
basePath
stringThe directory to enumerate files.
pattern
RegexThe regular expression pattern to use in selecting files to enumeration.
searchSubdirectories
boolSpecifies whether to recursively enumerate subdirectories of
basePath
.
Returns
- IEnumerable<string>
SanitizedPath(IFileProvider, string, char, string)
Replaces path separators in file name with newDirectorySeparatorChar
.
public static string SanitizedPath(this IFileProvider _, string fileName, char newDirectorySeparatorChar, string pathPrefix)
Parameters
_
IFileProviderExtension point.
fileName
stringOriginal file name.
newDirectorySeparatorChar
charNew path delimiter.
pathPrefix
stringOptional new file prefix folder.
Returns
- string