View Source
Class FileSystemExtensions
Assembly: Umbraco.Core.dll
Syntax
public static class FileSystemExtensions
Methods
View Source
CopyFile(IFileSystem, string, string)
Declaration
public static void CopyFile(this IFileSystem fs, string path, string newPath)
Parameters
| Type |
Name |
Description |
| IFileSystem |
fs |
|
| string |
path |
|
| string |
newPath |
|
View Source
CreateFolder(IFileSystem, string)
Declaration
public static void CreateFolder(this IFileSystem fs, string folderPath)
Parameters
View Source
GetExtension(IFileSystem, string)
Declaration
public static string GetExtension(this IFileSystem fs, string path)
Parameters
Returns
View Source
GetFileName(IFileSystem, string)
Declaration
public static string GetFileName(this IFileSystem fs, string path)
Parameters
Returns
View Source
GetStreamHash(Stream)
Declaration
public static string GetStreamHash(this Stream fileStream)
Parameters
| Type |
Name |
Description |
| Stream |
fileStream |
|
Returns
View Source
OpenReadWithRetry(FileInfo, int, int)
Attempts to open the file at
filePath
up to
maxRetries
times,
with a thread sleep time of
sleepPerRetryInMilliseconds
between retries.
Declaration
public static FileStream OpenReadWithRetry(this FileInfo file, int maxRetries = 5, int sleepPerRetryInMilliseconds = 50)
Parameters
| Type |
Name |
Description |
| FileInfo |
file |
|
| int |
maxRetries |
|
| int |
sleepPerRetryInMilliseconds |
|
Returns
| Type |
Description |
| FileStream |
|
View Source
TryCreateFileProvider(IFileSystem, out IFileProvider)
Creates a new Microsoft.Extensions.FileProviders.IFileProvider from the file system.
Declaration
public static bool TryCreateFileProvider(this IFileSystem fileSystem, out IFileProvider fileProvider)
Parameters
| Type |
Name |
Description |
| IFileSystem |
fileSystem |
The file system.
|
| IFileProvider |
fileProvider |
When this method returns, contains an Microsoft.Extensions.FileProviders.IFileProvider created from the file
system.
|
Returns
| Type |
Description |
| bool |
true if the Microsoft.Extensions.FileProviders.IFileProvider was successfully created; otherwise, false.
|