Options
All
  • Public
  • Public/Protected
  • All
Menu

A simple filesystem backed by HTTP downloads. You must create a directory listing using the make_http_index tool provided by BrowserFS.

If you install BrowserFS globally with npm i -g browserfs, you can generate a listing by running make_http_index in your terminal in the directory you would like to index:

make_http_index > index.json

Listings objects look like the following:

{
  "home": {
    "jvilk": {
      "someFile.txt": null,
      "someDir": {
        // Empty directory
      }
    }
  }
}

This example has the folder /home/jvilk with subfile someFile.txt and subfolder someDir.

Hierarchy

Implements

Index

Properties

prefixUrl

prefixUrl: string

Static Name

Name: "HTTPRequest" = "HTTPRequest"

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(path: string, cb: function): void

empty

  • empty(): void

exists

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

existsSync

  • existsSync(p: string): boolean

getName

  • getName(): string

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

  • openSync(path: string, flags: FileFlag, mode: number): File

preloadFile

  • preloadFile(path: string, buffer: Buffer): void
  • Special HTTPFS function: Preload the given file into the index.

    Parameters

    • path: string
    • buffer: Buffer

    Returns void

readFile

  • readFile(fname: string, encoding: string, flag: FileFlag, cb: BFSCallback<string | Buffer>): void

readFileSync

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

readdir

  • readdir(path: string, cb: BFSCallback<string[]>): void

readdirSync

  • readdirSync(path: string): string[]

readlink

readlinkSync

  • readlinkSync(p: string): string

realpath

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

realpathSync

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

rename

renameSync

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

rmdir

rmdirSync

  • rmdirSync(p: string): void

stat

statSync

  • statSync(path: string, isLstat: boolean): 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 Create

Static isAvailable

  • isAvailable(): boolean

Object literals

Static Options

Options: object

baseUrl

baseUrl: object

description

description: string = "Used as the URL prefix for fetched files. Default: Fetch files relative to the index."

optional

optional: boolean = true

type

type: string = "string"

index

index: object

description

description: string = "URL to a file index as a JSON file or the file index object itself, generated with the make_http_index script. Defaults to `index.json`."

optional

optional: boolean = true

type

type: string[] = ["string", "object"]

preferXHR

preferXHR: object

description

description: string = "Whether to prefer XmlHttpRequest or fetch for async operations if both are available. Default: false"

optional

optional: boolean = true

type

type: string = "boolean"

Generated using TypeDoc