FileSystemDirectoryHandle Class
A handle to a directory (https://fs.spec.whatwg.org/#api-filesystemdirectoryhandle). In the scripts, it is an async iterable of its entries (entries(), keys(), values()); in .NET, see FileSystemDirectoryHandle.GetEntriesAsync.
public sealed class FileSystemDirectoryHandle : FileSystemHandle- Inheritance
FileSystemHandleFileSystemDirectoryHandle
Properties
| Name | Description |
|---|---|
| Kind | Gets the kind of the entry. |
Gets the kind of the entry.
public override FileSystemHandleKind Kind { get; }Methods
| Name | Description |
|---|---|
| GetDirectoryHandle(string, FileSystemGetDirectoryOptions?) | Returns a handle to the directory named name of the directory (https://fs.spec.whatwg.org/#dom-filesystemdirectoryhandle-getdirectoryhandle), created when it does not exist and the FileSystemGetDirectoryOptions.Create option is set. The task fails as the one of FileSystemDirectoryHandle.GetFileHandle. |
| GetEntriesAsync() | Iterates over the entries of the directory (https://fs.spec.whatwg.org/#api-filesystemdirectoryhandle-asynciterable), in no particular order: the entries created or removed during the iteration may or may not be returned. |
| GetFileHandle(string, FileSystemGetFileOptions?) | Returns a handle to the file named name of the directory (https://fs.spec.whatwg.org/#dom-filesystemdirectoryhandle-getfilehandle), created when it does not exist and the FileSystemGetFileOptions.Create option is set. The task fails with a TypeErrorException for an invalid name, a NotFoundError when the directory or the file does not exist, and a TypeMismatchError when the name is the one of a directory. |
| RemoveEntry(string, FileSystemRemoveOptions?) | Removes the entry named name of the directory (https://fs.spec.whatwg.org/#dom-filesystemdirectoryhandle-removeentry). The task fails with a TypeErrorException for an invalid name, a NotFoundError when the directory or the entry does not exist, an InvalidModificationError for a directory that is not empty without the FileSystemRemoveOptions.Recursive option, and (as in the browsers) a NoModificationAllowedError while a writable stream or an access handle of the file, or of a file of the directory, is open. |
| Resolve(FileSystemHandle) | Returns the names of the directories from this directory to possibleDescendant, then its name (https://fs.spec.whatwg.org/#dom-filesystemdirectoryhandle-resolve): an empty list for the directory itself, and null when the entry is not in the directory. |
GetDirectoryHandle(string, FileSystemGetDirectoryOptions?)
FileSystemHandle.csReturns a handle to the directory named name of the directory (https://fs.spec.whatwg.org/#dom-filesystemdirectoryhandle-getdirectoryhandle), created when it does not exist and the FileSystemGetDirectoryOptions.Create option is set. The task fails as the one of FileSystemDirectoryHandle.GetFileHandle.
public Task<FileSystemDirectoryHandle> GetDirectoryHandle(string name, FileSystemGetDirectoryOptions? options = null)Parameters
namestringoptionsFileSystemGetDirectoryOptions?
Returns
Task<FileSystemDirectoryHandle>
See also
GetEntriesAsync()
FileSystemHandle.csIterates over the entries of the directory (https://fs.spec.whatwg.org/#api-filesystemdirectoryhandle-asynciterable), in no particular order: the entries created or removed during the iteration may or may not be returned.
public IAsyncEnumerable<KeyValuePair<string, FileSystemHandle>> GetEntriesAsync()GetFileHandle(string, FileSystemGetFileOptions?)
FileSystemHandle.csReturns a handle to the file named name of the directory (https://fs.spec.whatwg.org/#dom-filesystemdirectoryhandle-getfilehandle), created when it does not exist and the FileSystemGetFileOptions.Create option is set. The task fails with a TypeErrorException for an invalid name, a NotFoundError when the directory or the file does not exist, and a TypeMismatchError when the name is the one of a directory.
public Task<FileSystemFileHandle> GetFileHandle(string name, FileSystemGetFileOptions? options = null)RemoveEntry(string, FileSystemRemoveOptions?)
FileSystemHandle.csRemoves the entry named name of the directory (https://fs.spec.whatwg.org/#dom-filesystemdirectoryhandle-removeentry). The task fails with a TypeErrorException for an invalid name, a NotFoundError when the directory or the entry does not exist, an InvalidModificationError for a directory that is not empty without the FileSystemRemoveOptions.Recursive option, and (as in the browsers) a NoModificationAllowedError while a writable stream or an access handle of the file, or of a file of the directory, is open.
public Task RemoveEntry(string name, FileSystemRemoveOptions? options = null)Resolve(FileSystemHandle)
FileSystemHandle.csReturns the names of the directories from this directory to possibleDescendant, then its name (https://fs.spec.whatwg.org/#dom-filesystemdirectoryhandle-resolve): an empty list for the directory itself, and null when the entry is not in the directory.
public Task<IReadOnlyList<string>?> Resolve(FileSystemHandle possibleDescendant)