From Wiki96
Jump to: navigation, search
m (Reverted edits by 94.233.241.205 (talk) to last revision by Utf)
Tag: Rollback
m (Dare you scan mode!)
Line 46: Line 46:
Deletes a file at the specified path.
Deletes a file at the specified path.


=== <code>readdir(path: String): String[]</code> ===
=== <code>readdir(path: String, scan_mode: Boolean): String[]</code> ===
 
* If scan_mode is set to true, then the filetype is included with the path
 
Returns a list of entities contained in the specified path.
Returns a list of entities contained in the specified path.



Revision as of 17:54, 26 October 2023

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, scan_mode: Boolean): String[]

  • If scan_mode is set to true, then the filetype is included with the path

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()