Class FolderAdapter

The FolderAdapter file system wraps a file system, and scopes all interactions to a subfolder of that file system.

Example: Given a file system foo with folder bar and file bar/baz...

BrowserFS.configure({
fs: "FolderAdapter",
options: {
folder: "bar",
wrapped: foo
}
}, function(e) {
var fs = BrowserFS.BFSRequire('fs');
fs.readdirSync('/'); // ['baz']
});

Hierarchy

Constructors

Properties

_folder: string
_ready: Promise<FolderAdapter> = ...
_wrapped: FileSystem
Create: any = ...
Name: "FolderAdapter" = 'FolderAdapter'

Accessors

  • get metadata(): {
        freeSpace: number;
        name: string;
        readonly: boolean;
        supportsLinks: boolean;
        supportsProperties: boolean;
        synchronous: boolean;
        totalSpace: number;
    }
  • Returns {
        freeSpace: number;
        name: string;
        readonly: boolean;
        supportsLinks: boolean;
        supportsProperties: boolean;
        synchronous: boolean;
        totalSpace: number;
    }

    • freeSpace: number

      The available space

    • name: string

      The name of the FS

    • readonly: boolean

      Wheter the FS is readonly or not

    • supportsLinks: boolean
    • supportsProperties: boolean

      Does the FS support properties

    • synchronous: boolean

      Does the FS support synchronous operations

    • totalSpace: number

      The total space

Methods

  • Asynchronously append data to a file, creating the file if it not yet exists.

    Parameters

    • fname: string
    • data: Uint8Array
    • flag: FileFlag
    • mode: number
    • cred: Cred

    Returns Promise<void>

  • Asynchronous chown.

    Parameters

    • p: string
    • new_uid: number
    • new_gid: number
    • cred: Cred

    Returns Promise<void>

  • Test whether or not the given path exists by checking with the file system. Then call the callback argument with either true or false.

    Parameters

    • p: string
    • cred: Cred

    Returns Promise<boolean>

  • Asynchronous mkdir.

    Parameters

    • p: string
    • mode: number

      Mode to make the directory using. Can be ignored if the filesystem doesn't support permissions.

    • cred: Cred

    Returns Promise<void>

  • Synchronous mkdir.

    Parameters

    • p: string
    • mode: number

      Mode to make the directory using. Can be ignored if the filesystem doesn't support permissions.

    • cred: Cred

    Returns void

  • Opens the file at path p with the given flag. The file must exist.

    Parameters

    • p: string

      The path to open.

    • flag: FileFlag

      The flag to use when opening the file.

    • cred: Cred

    Returns File

    A File object corresponding to the opened file.

  • Asynchronous readdir. Reads the contents of a directory.

    The callback gets two arguments (err, files) where files is an array of the names of the files in the directory excluding '.' and '..'.

    Parameters

    • p: string
    • cred: Cred

    Returns Promise<string[]>

  • Asynchronous realpath. The callback gets two arguments (err, resolvedPath).

    Note that the Node API will resolve path to an absolute path.

    Parameters

    • p: string
    • cred: Cred

    Returns Promise<string>

  • Asynchronous rename. No arguments other than a possible exception are given to the completion callback.

    Parameters

    • oldPath: string
    • newPath: string
    • cred: Cred

    Returns Promise<void>

  • Asynchronous symlink.

    Parameters

    • srcpath: string
    • dstpath: string
    • type: string

      can be either 'dir' or 'file'

    • cred: Cred

    Returns Promise<void>

  • Synchronous symlink.

    Parameters

    • srcpath: string
    • dstpath: string
    • type: string

      can be either 'dir' or 'file'

    • cred: Cred

    Returns void

  • Change file timestamps of the file referenced by the supplied path.

    Parameters

    • p: string
    • atime: Date
    • mtime: Date
    • cred: Cred

    Returns Promise<void>

  • Change file timestamps of the file referenced by the supplied path.

    Parameters

    • p: string
    • atime: Date
    • mtime: Date
    • cred: Cred

    Returns void

  • Asynchronously writes data to a file, replacing the file if it already exists.

    The encoding option is ignored if data is a buffer.

    Parameters

    • fname: string
    • data: Uint8Array
    • flag: FileFlag
    • mode: number
    • cred: Cred

    Returns Promise<void>

  • Synchronously writes data to a file, replacing the file if it already exists.

    The encoding option is ignored if data is a buffer.

    Parameters

    • fname: string
    • data: Uint8Array
    • flag: FileFlag
    • mode: number
    • cred: Cred

    Returns void

Generated using TypeDoc