Interface FsFileSystem

Initialized file system

interface FsFileSystem {
    capabilities: FsCapabilities;
    getFile: (path: string) => FsFile;
    getOpenedPaths: () => string[];
    listDir: (path: string) => Promise<FsResult<string[]>>;
    root: string;
}

Properties

capabilities: FsCapabilities

Capabilities of this file system implementation See README.md for more information

getFile: (path: string) => FsFile

Get a file object for operations

The returned object can store temporary state for the file, such as newer content. Calling openFile with the same path will return the same object.

Note that opening a file doesn't actually block the file from being modified by programs other than the browser.

You can make the FsFileSystem forget about the file by calling close on the file object.

getOpenedPaths: () => string[]

Get all paths that getFile has been called with but not closed

listDir: (path: string) => Promise<FsResult<string[]>>

List files in a directory

The input path should be relative to the root (of the uploaded directory).

Returns a list of file names in the directory (not full paths). Directory names end with a slash.

Returns Fail if the underlying file system operation fails.

root: string

Get the root path of the file system for display

The returned string has no significance in the file system itself. It should only be used as an indicator to the user.