Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace VFS

This namespace is dedicated to all APIs related to AntOS Virtual File System (VFS)

Index

Variables

Const handles

Placeholder stores VFS file protocol patterns and its attached file handle class.

Functions

cat

  • cat(list: string[], data: string, join_by?: string): Promise<string>
  • Cat all files to a single out-put

    export

    Parameters

    • list: string[]

      list of VFS files

    • data: string

      input data string that will be cat to the files content

    • Default value join_by: string = ""

      join on files content by this string

    Returns Promise<string>

    {Promise}

copy

  • copy(files: string[], to: string): Promise<any[]>
  • Copy files to a folder

    export

    Parameters

    • files: string[]

      list of files

    • to: string

      destination folder

    Returns Promise<any[]>

    {Promise<any[]>}

extractZip

  • extractZip(zfile: string | BaseFileHandle, dest_callback: (zip: any) => Promise<string>): Promise<void>
  • export

    Extract a zip fle

    Parameters

    • zfile: string | BaseFileHandle

      zip file to extract

    • dest_callback: (zip: any) => Promise<string>
        • (zip: any): Promise<string>
        • Parameters

          • zip: any

          Returns Promise<string>

    Returns Promise<void>

    {Promise}

findHandles

  • Looking for a attached file handle class of a string protocol

    When converting a string to file handle, the system will look for a protocol pattern in the string, if the protocol found, its attached handle class (found in VFS.handles) will be used to initialize a file handle object from the string

     "home://data/test.txt".asFileHandle() // -> an instance of RemoteFileHandle
    
    export

    Parameters

    • proto: string

      protocol string

    Returns VFSFileHandleClass[]

mkar

  • mkar(src: string, dest: string): Promise<void>
  • Create a zip archive from a folder

    export

    Parameters

    • src: string

      source file/folder

    • dest: string

      destination archive

    Returns Promise<void>

    {Promise}

mkdirAll

  • mkdirAll(list: string[], sync?: boolean): Promise<any>
  • Create a list of directories

    export

    Parameters

    • list: string[]

      of directories to be created

    • Optional sync: boolean

      sync/async of directory creation

    Returns Promise<any>

    {Promise}

mktpl

  • mktpl(list: Array<string[]>, path: string, callback: (data: string) => string): Promise<any[]>
  • Make files from a set of template files

    export

    Parameters

    • list: Array<string[]>

      mapping paths between templates files and created files

    • path: string

      files destination

    • callback: (data: string) => string
        • (data: string): string
        • Parameters

          • data: string

          Returns string

    Returns Promise<any[]>

    {Promise<any[]>}

readFileFromZip

  • readFileFromZip(file: string, type: string, file_name?: string): Promise<any>
  • Read a file content from a zip archive

    The content type should be:

    • base64 : the result will be a string, the binary in a base64 form.
    • text (or string): the result will be an unicode string.
    • binarystring: the result will be a string in “binary” form, using 1 byte per char (2 bytes).
    • array: the result will be an Array of bytes (numbers between 0 and 255).
    • uint8array : the result will be a Uint8Array. This requires a compatible browser.
    • arraybuffer : the result will be a ArrayBuffer. This requires a compatible browser.
    • blob : the result will be a Blob. This requires a compatible browser. * If file_name is not specified, the first file_name in the zip archive will be read
    export

    Parameters

    • file: string

      zip file

    • type: string

      content type to read

    • Optional file_name: string

    Returns Promise<any>

    {Promise}

read_files

register