Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FolderAdapter

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

Hierarchy

Implements

Index

Constructors

constructor

  • Wraps a file system, and uses the given folder as its root.

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

    var adapter = new BrowserFS.FileSystem.FolderAdapter('bar', foo);
    adapter.readdirSync('/'); // ['baz']
    

    Parameters

    • folder: string

      The folder to use as the root directory.

    • wrapped: FileSystem

      The file system to wrap.

    Returns FolderAdapter

Properties

_folder

_folder: string

_wrapped

_wrapped: FileSystem

Methods

appendFile

appendFileSync

  • appendFileSync(fname: string, data: any, encoding: string | null, flag: FileFlag, mode: number): void

chmod

chmodSync

  • chmodSync(p: string, isLchmod: boolean, mode: number): void

chown

  • chown(p: string, isLchown: boolean, uid: number, gid: number, cb: BFSOneArgCallback): void

chownSync

  • chownSync(p: string, isLchown: boolean, uid: number, gid: number): void

createFile

createFileSync

  • createFileSync(p: string, flag: FileFlag, mode: number): File

diskSpace

  • diskSpace(p: string, cb: function): void

exists

  • exists(p: string, cb: function): void

existsSync

  • existsSync(p: string): boolean

getName

  • getName(): string

initialize

  • initialize(cb: function): void
  • Initialize the file system. Ensures that the wrapped file system has the given folder.

    Parameters

    • cb: function

    Returns void

isReadOnly

  • isReadOnly(): boolean

link

linkSync

  • linkSync(srcpath: string, dstpath: string): void

mkdir

mkdirSync

  • mkdirSync(p: string, mode: number): void

open

openFile

openFileSync

  • openFileSync(p: string, flag: FileFlag, mode: number): File
  • 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.

    • mode: number

    Returns File

    A File object corresponding to the opened file.

openSync

readFile

readFileSync

  • readFileSync(fname: string, encoding: string | null, flag: FileFlag): any

readdir

readdirSync

  • readdirSync(p: string): string[]

readlink

readlinkSync

  • readlinkSync(p: string): string

realpath

  • realpath(p: string, cache: object, cb: BFSCallback): void

realpathSync

  • realpathSync(p: string, cache: object): string

rename

renameSync

  • renameSync(oldPath: string, newPath: string): void

rmdir

rmdirSync

  • rmdirSync(p: string): void

stat

  • stat(p: string, isLstat: boolean | null, cb: BFSCallback): void

statSync

  • statSync(p: string, isLstat: boolean | null): Stats

supportsLinks

  • supportsLinks(): boolean

supportsProps

  • supportsProps(): boolean

supportsSynch

  • supportsSynch(): boolean

symlink

  • symlink(srcpath: string, dstpath: string, type: string, cb: BFSOneArgCallback): void

symlinkSync

  • symlinkSync(srcpath: string, dstpath: string, type: string): void

truncate

truncateSync

  • truncateSync(p: string, len: number): void

unlink

unlinkSync

  • unlinkSync(p: string): void

utimes

utimesSync

  • utimesSync(p: string, atime: Date, mtime: Date): void

writeFile

writeFileSync

  • writeFileSync(fname: string, data: any, encoding: string | null, flag: FileFlag, mode: number): void

Static isAvailable

  • isAvailable(): boolean

Generated using TypeDoc