Options
All
  • Public
  • Public/Protected
  • All
Menu

The Windows 96 file system API.

Hierarchy

  • FS

Index

Methods

_invokeFsFunc

  • _invokeFsFunc(path: string, prefix: string, func_name: string): any
  • [ Internal function - use is discouraged. ] Invokes a function on a class implementing IFileSystem.

    Parameters

    • path: string

      A reference path to use for thrown error objects.

    • prefix: string

      The prefix of the file system to use.

    • func_name: string

      The function to invoke.

    Returns any

assert

  • Checks if the required FS structure is present.

    Parameters

    Returns Promise<void>

cache

  • Caches a file. Note that this does not track FS changes.

    Parameters

    • path: string

      The path of the file to cache.

    • opts: FileCachingOptions

      The options to use.

    Returns Promise<void>

cpdir

  • cpdir(src: string, dest: string): Promise<boolean>
  • Copies a directory to a new destination.

    Parameters

    • src: string

      The source path to copy from.

    • dest: string

      The destination path to place copied files.

    Returns Promise<boolean>

cpfile

  • cpfile(src: string, dest: string): Promise<boolean>
  • Copies a file to a new destination.

    Parameters

    • src: string

      The source path to copy from.

    • dest: string

      The destination path to place the copied file.

    Returns Promise<boolean>

exists

  • exists(path: string): Promise<boolean>
  • Checks if an entity exists.

    Parameters

    • path: string

      The path to check for.

    Returns Promise<boolean>

filetype

  • filetype(path: string): Promise<0 | 1 | -1>
  • Returns the file type of a node. This can be a binary or text file.

    Parameters

    • path: string

      The path to check for.

    Returns Promise<0 | 1 | -1>

    A number representing the file type.

get

  • Retuns a file system object (FSO) by its prefix.

    Parameters

    • prefix: string

      The prefix of the FSO to query.

    Returns IFileSystem

    The file system object.

getFromCache

  • getFromCache(path: string): string | Uint8Array | Blob
  • Returns a file from cache.

    Parameters

    • path: string

    Returns string | Uint8Array | Blob

hash

  • hash(path: string, algo?: "default" | "md5" | "sha256" | "sha384" | "sha512"): Promise<string>
  • Hashes a file.

    Parameters

    • path: string

      The path of the file to hash.

    • Optional algo: "default" | "md5" | "sha256" | "sha384" | "sha512"

      The algorithm to use.

    Returns Promise<string>

isEmpty

  • isEmpty(path: string): Promise<boolean>
  • Checks if a file is empty.

    Parameters

    • path: string

      The path to check for.

    Returns Promise<boolean>

isFile

  • isFile(path: string): Promise<boolean>
  • Checks if the specified entity is a file.

    Parameters

    • path: string

      The path to check for.

    Returns Promise<boolean>

list

  • list(): string[]
  • Gets all mounted file system prefixes.

    Returns string[]

mkdir

  • mkdir(path: string): Promise<boolean>
  • Creates a new directory (and subdirectories if they do not exist).

    Parameters

    • path: string

      The path of the directory to create.

    Returns Promise<boolean>

mount

  • mount(fso: IFileSystem, forcePrefix?: string, ignoreTypeCheck?: boolean): Promise<void>
  • Mounts a file system using the specified object ("driver").

    Parameters

    • fso: IFileSystem

      The file system object to mount.

    • Optional forcePrefix: string

      Whether a forced prefix (rather than the prefixed defined in the FSO) should be used.

    • Optional ignoreTypeCheck: boolean

      Whether to check if FSO is an instance of IFileSystem

    Returns Promise<void>

mounts

  • Gets all mounted file system objects.

    Returns IFileSystem[]

    The file system objects.

mvdir

  • mvdir(src: string, dest: string): Promise<boolean>
  • Moves a directory to a new destination.

    Parameters

    • src: string

      The source path to move from.

    • dest: string

      The destination path to place moved files.

    Returns Promise<boolean>

mvfile

  • mvfile(src: string, dest: string): Promise<boolean>
  • Moves a file to a new destination.

    Parameters

    • src: string

      The source path to move from.

    • dest: string

      The destination path to place the moved file.

    Returns Promise<boolean>

nextLetter

  • nextLetter(): string
  • Get the next available drive letter.

    Returns string

    The next available letter or null if nothing was found.

readBinChunk

  • readBinChunk(path: string, offset: number, length: number): Promise<Uint8Array>
  • Reads a part of a file.

    Parameters

    • path: string

      The path to read from.

    • offset: number

      The starting offset.

    • length: number

      The length of data to read.

    Returns Promise<Uint8Array>

readStrChunk

  • readStrChunk(path: string, offset: number, length: number): Promise<string>
  • Reads a part of a file as string.

    Parameters

    • path: string

      The path to read from.

    • offset: number

      The starting offset.

    • length: number

      The length of data to read.

    Returns Promise<string>

readbin

  • readbin(path: string): Promise<Uint8Array>
  • Reads the specified file as binary.

    Parameters

    • path: string

      The path of the file to read.

    Returns Promise<Uint8Array>

    File contents as byte array.

readdir

  • Returns a list of entities contained in the specified path.

    Parameters

    • path: string

      The directory path to read.

    • Optional scan: boolean

      Whether to retrieve files in scan mode.

    Returns Promise<string[] | FSScanModeResult[]>

readstr

  • readstr(path: string): Promise<string>
  • Reads the specified file as a string.

    Parameters

    • path: string

      The path of the file to read.

    Returns Promise<string>

    The text of the file.

rename

  • rename(path: string, newName: string): Promise<boolean>
  • Renames a file or folder.

    Parameters

    • path: string

      The path to rename.

    • newName: string

      The new name of the directory/file to use.

    Returns Promise<boolean>

rm

  • rm(path: string): Promise<boolean>
  • Deletes the specified file.

    Parameters

    • path: string

      The path of the file to remove.

    Returns Promise<boolean>

rmdir

  • rmdir(path: string): Promise<boolean>
  • Removes a directory and its contents.

    Parameters

    • path: string

      The path of the directory to remove.

    Returns Promise<boolean>

stat

  • Retrieves information about a file system entry.

    Parameters

    • path: string

      The path to retrieve information for.

    Returns Promise<FSBasicStat>

toBlob

  • toBlob(path: string): Promise<Blob>
  • Constructs a blob from the specified file.

    Parameters

    • path: string

      The path of the file to construct a blob from.

    Returns Promise<Blob>

toURL

  • toURL(path: string): Promise<string>
  • Returns the URL for a path.

    Parameters

    • path: string

      The path to retrieve an URL for.

    Returns Promise<string>

touch

  • touch(path: string): Promise<boolean>
  • Creates a new file.

    Parameters

    • path: string

      The path of the file to create.

    Returns Promise<boolean>

umount

  • umount(prefix: string): Promise<void>
  • Unmounts a file system instance.

    Parameters

    • prefix: string

      The prefix of the file system instance to unmount.

    Returns Promise<void>

uncache

  • uncache(path: string): void
  • Uncaches a file.

    Parameters

    • path: string

      The path of the file to uncache.

    Returns void

walk

  • walk(path: string): Promise<string[]>
  • Walks through the contents of a directory.

    Parameters

    • path: string

      The path to walk.

    Returns Promise<string[]>

writebin

  • writebin(path: string, data: Uint8Array | number[]): Promise<boolean>
  • Truncates and writes data to the specified file.

    Parameters

    • path: string

      The path of the file to write to.

    • data: Uint8Array | number[]

      The data to write.

    Returns Promise<boolean>

writestr

  • writestr(path: string, data: string): Promise<boolean>
  • Truncates and writes a UTF-8 encoded string to the specified file.

    Parameters

    • path: string

      The path of the file to write to.

    • data: string

      The string to write.

    Returns Promise<boolean>

Generated using TypeDoc