Interface IUnixFileSystem
The unix file system abstraction used by the FTP server.
Namespace: FubarDev.FtpServer.FileSystem
Assembly: FubarDev.FtpServer.Abstractions.dll
Syntax
public interface IUnixFileSystem
Properties
| Improve this Doc View SourceFileSystemEntryComparer
Gets a string comparer for file system entry names.
Declaration
StringComparer FileSystemEntryComparer { get; }
Property Value
Type | Description |
---|---|
StringComparer |
Remarks
Required to support case insensitive file systems.
Root
Gets the root directory entry.
Declaration
IUnixDirectoryEntry Root { get; }
Property Value
Type | Description |
---|---|
IUnixDirectoryEntry |
SupportsAppend
Gets a value indicating whether this file system supports appending to a file.
Declaration
bool SupportsAppend { get; }
Property Value
Type | Description |
---|---|
Boolean |
SupportsNonEmptyDirectoryDelete
Gets a value indicating whether this file system supports deletion of non-empty directories.
Declaration
bool SupportsNonEmptyDirectoryDelete { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceAppendAsync(IUnixFileEntry, Nullable<Int64>, Stream, CancellationToken)
Appends data to a file.
Declaration
Task<IBackgroundTransfer? > AppendAsync(IUnixFileEntry fileEntry, long? startPosition, Stream data, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IUnixFileEntry | fileEntry | The IUnixFileEntry to append data to. |
Nullable<Int64> | startPosition | The start position - when it is null, the data is appended. |
Stream | data | The data stream to read from. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<Nullable<IBackgroundTransfer>> | an optional IBackgroundTransfer when the transfer needs to happen in the background. |
CreateAsync(IUnixDirectoryEntry, String, Stream, CancellationToken)
Creates a file with the given fileName
and data
.
Declaration
Task<IBackgroundTransfer? > CreateAsync(IUnixDirectoryEntry targetDirectory, string fileName, Stream data, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IUnixDirectoryEntry | targetDirectory | The directory to create the file in. |
String | fileName | The name of the new file. |
Stream | data | The Stream used to read the data for the new file. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<Nullable<IBackgroundTransfer>> | an optional IBackgroundTransfer when the transfer needs to happen in the background. |
CreateDirectoryAsync(IUnixDirectoryEntry, String, CancellationToken)
Creates a sub directory with the name directoryName
in targetDirectory
.
Declaration
Task<IUnixDirectoryEntry> CreateDirectoryAsync(IUnixDirectoryEntry targetDirectory, string directoryName, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IUnixDirectoryEntry | targetDirectory | The directory to create the sub directory in. |
String | directoryName | The name of the new sub directory. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IUnixDirectoryEntry> | The new IUnixDirectoryEntry. |
GetEntriesAsync(IUnixDirectoryEntry, CancellationToken)
Gets a list of IUnixFileSystemEntry objects for a given directoryEntry
.
Declaration
Task<IReadOnlyList<IUnixFileSystemEntry>> GetEntriesAsync(IUnixDirectoryEntry directoryEntry, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IUnixDirectoryEntry | directoryEntry | The IUnixDirectoryEntry to get the file system entries for. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IReadOnlyList<IUnixFileSystemEntry>> | The list of IUnixFileSystemEntry objects for a given |
GetEntryByNameAsync(IUnixDirectoryEntry, String, CancellationToken)
Gets a file system entry by name.
Declaration
Task<IUnixFileSystemEntry? > GetEntryByNameAsync(IUnixDirectoryEntry directoryEntry, string name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IUnixDirectoryEntry | directoryEntry | The IUnixDirectoryEntry to get the file system entry for. |
String | name | The name of the file system entry to search. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<Nullable<IUnixFileSystemEntry>> | Returns the found IUnixFileSystemEntry. |
MoveAsync(IUnixDirectoryEntry, IUnixFileSystemEntry, IUnixDirectoryEntry, String, CancellationToken)
Moves a file system entry from parent
to target
.
Declaration
Task<IUnixFileSystemEntry> MoveAsync(IUnixDirectoryEntry parent, IUnixFileSystemEntry source, IUnixDirectoryEntry target, string fileName, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IUnixDirectoryEntry | parent | The IUnixDirectoryEntry of |
IUnixFileSystemEntry | source | The IUnixFileSystemEntry to move. |
IUnixDirectoryEntry | target | The destination IUnixDirectoryEntry where |
String | fileName | The new name of |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IUnixFileSystemEntry> | Returns the new IUnixFileSystemEntry. |
OpenReadAsync(IUnixFileEntry, Int64, CancellationToken)
Opens a file for reading.
Declaration
Task<Stream> OpenReadAsync(IUnixFileEntry fileEntry, long startPosition, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IUnixFileEntry | fileEntry | The IUnixFileEntry to read from. |
Int64 | startPosition | The start position to read from. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<Stream> | The Stream to be used for reading. |
ReplaceAsync(IUnixFileEntry, Stream, CancellationToken)
Replaces the contents of a file.
Declaration
Task<IBackgroundTransfer? > ReplaceAsync(IUnixFileEntry fileEntry, Stream data, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IUnixFileEntry | fileEntry | The IUnixFileEntry to replace the data for. |
Stream | data | The data to be written to the given |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<Nullable<IBackgroundTransfer>> | an optional IBackgroundTransfer when the transfer needs to happen in the background. |
SetMacTimeAsync(IUnixFileSystemEntry, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, CancellationToken)
Sets the modify/access/create timestamp of a file system item.
Declaration
Task<IUnixFileSystemEntry> SetMacTimeAsync(IUnixFileSystemEntry entry, DateTimeOffset? modify, DateTimeOffset? access, DateTimeOffset? create, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IUnixFileSystemEntry | entry | The IUnixFileSystemEntry to change the timestamp for. |
Nullable<DateTimeOffset> | modify | The modification timestamp. |
Nullable<DateTimeOffset> | access | The access timestamp. |
Nullable<DateTimeOffset> | create | The creation timestamp. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<IUnixFileSystemEntry> | The modified IUnixFileSystemEntry. |
UnlinkAsync(IUnixFileSystemEntry, CancellationToken)
Deletes a IUnixFileSystemEntry.
Declaration
Task UnlinkAsync(IUnixFileSystemEntry entry, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IUnixFileSystemEntry | entry | The IUnixFileSystemEntry to delete. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task | The task where the underlying action is performed on. |
Remarks
An implementation might decide to move the entry
into the trash instead of deleting it.