From Wiki96
Revision as of 00:59, 23 March 2023 by Utf (talk | contribs) (Spelling: Primise -> Promise)
Jump to: navigation, search

class FS

This namespace refers to the file system API of Windows 96. w96.FS allows manipulation of file system entries by, for example, renaming, deleting or copying them. It is also possible to create, read and write files and directories.

Structure

mount(fso: IFileSystem): Promise<void>

Mounts a file system using the specified object ("driver").

umount(prefix: String): Promise<void>

Unmounts a file system instance.

mounts(): IFileSystem[]

Gets all mounted file systems.

list(): String[]

Gets all mounted file system prefixes.

nextLetter(): String

Get the next available drive letter.

toBlob(path: String): Promise<Blob>

Creates a blob from a specified path.

get(prefix: String): IFileSystem

Retuns a file system by its prefix.

toURL(path: String): Promise<String>

Creates a URL from the specified file path.

isFile(path: String): Promise<Boolean>

Returns true if the entry is a file.

isEmpty(path: String): Promise<Boolean>

Returns true if the file is empty.

mkdir(path: String): Promise<Boolean>

Creates a directory at the specified path.

rmdir(path: String): Promise<Boolean>

Deletes a directory at the specified path.

touch(path: String): Promise<Boolean>

Creates a file at the specified path.

rm(path: String): Promise<Boolean>

Deletes a file at the specified path.

readdir(path: String): String[]

Returns a list of entities contained in the specified path.

cpdir(src: String, dest: String): Promise<Boolean>

Copies a directory to a new destination.

cpfile(src: String, dest: String): Promise<Boolean>

Copies a file to a new destination.

mvfile(src: String, dest: String): Promise<Boolean>

Moves a file to a new destination.

mvdir(src: String, dest: String): Promise<Boolean>

Moves a directory to a new destination.

exists(path: String): Boolean

Checks if an entity exists.

readstr(path: String): Promise<String>

Reads the specified file as a string.

readbin(path: String): Promise<Uint8Array>

Reads the specified file as binary.

filetype(path: String): 0 | 1 | -1

Returns the file type of a node. This can be a binary or text file.

writestr(path: String, data: String): Promise<Boolean>

Truncates and writes a UTF-8 encoded string to the specified file.

writebin(path: String, data: Uint8Array | Number[]): Promise<Boolean>

Truncates and writes data to the specified file.

walk(path: String): String[]

Walks through the contents of a directory.

stat(path: String): FSStatResult

Retrieves information about a file system entry.

rename(path: String, newName: String): Promise<Boolean>

Renames a file or folder.

readBinChunk()

readStrChunk()

cache()

uncache()

getFromCache()

hash(path: String, algorithm: "default" | "md5" | "sha256" | "sha512"): Promise<String>

Create a hash from a given path and algorithm.

assert()