Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SharedFileHandle

Shared file handle represents all AntOS shared file. Its protocol is defined as:

^shared$

Hierarchy

Index

Constructors

constructor

Properties

basename

basename: string

File base name

memberof

BaseFileHandle

cache

cache: any

Once read, file content will be cached in this placeholder

memberof

BaseFileHandle

dirty

dirty: boolean

Flag indicates whether the file is dirty

memberof

BaseFileHandle

ext

ext: string

File extension

memberof

BaseFileHandle

genealogy

genealogy: string[]

List of path segments

memberof

BaseFileHandle

info

Once loaded, ready will be set to true and file meta-data will be stored in this place holder

memberof

BaseFileHandle

path

path: string

File path

memberof

BaseFileHandle

protocol

protocol: string

File protocol e.g:

  • os://
  • home://
memberof

BaseFileHandle

ready

ready: boolean

Flag indicated whether the file meta-data is loaded

memberof

BaseFileHandle

type

type: string

File type

memberof

BaseFileHandle

Accessors

filename

  • get filename(): string
  • set filename(v: string): void

Methods

Protected _down

  • _down(): Promise<void>

Protected _exec

  • Low level protocol-specific execute operation

    This function should be overridden by the file handle class that supports the operation

    memberof

    BaseFileHandle

    Returns Promise<RequestResult>

Protected _mk

  • Low level protocol-specific sub-directory creation

    This function should be overridden by the file handle class that supports the operation

    memberof

    BaseFileHandle

    Parameters

    • d: string

      sub directory name

    Returns Promise<RequestResult>

Protected _mv

  • Low level protocol-specific move operation

    This function should be overridden by the file handle class that supports the operation

    memberof

    BaseFileHandle

    Parameters

    • d: string

    Returns Promise<RequestResult>

Protected _pub

Protected _rd

  • _rd(t: string): Promise<any>

Protected _rm

Protected _up

  • Low level protocol-specific upload operation

    This function should be overridden by the file handle class that supports the operation

    memberof

    BaseFileHandle

    Returns Promise<RequestResult>

Protected _wr

asFileHandle

Protected b64

  • b64(t: string): Promise<string | ArrayBuffer>
  • Convert the current file cache to Base64

    memberof

    BaseFileHandle

    Parameters

    • t: string

      type of the file cache:

      • object
      • mime type

    Returns Promise<string | ArrayBuffer>

    promise on the converted data

download

  • download(): Promise<any>
  • Download the file.

    Only work with file

    This function calls the _down function to perform the operation

    memberof

    BaseFileHandle

    Returns Promise<any>

    Promise on the operation result

execute

  • execute(): Promise<any>
  • Execute the current file.

    This action depends on each file protocol

    This function calls the _exec function to perform the operation

    memberof

    BaseFileHandle

    Returns Promise<any>

getlink

  • getlink(): string

hash

  • hash(): number

isHidden

  • isHidden(): boolean

isRoot

  • isRoot(): boolean

meta

mk

  • Sub-directory creation

    This function calls the _mk function to perform the operation

    memberof

    BaseFileHandle

    Parameters

    • d: string

      sub directory name

    Returns Promise<RequestResult>

    promise on the operation result

move

  • Move the current file to another location

    This function calls the _mv function to perform the operation

    memberof

    BaseFileHandle

    Parameters

    • d: string

      destination location

    Returns Promise<RequestResult>

    promise on the operation result

onready

parent

publish

read

  • read(t?: string): Promise<any>
  • Public read operation

    This function calls the _rd function to perform the operation.

    If the current file is a directory, then the operation will return the meta-data of all files inside of the directory. Otherwise, file content will be returned

    memberof

    BaseFileHandle

    Parameters

    • Optional t: string

      data type

      • jsonp: the response is an json object
      • script: the response is a javascript code
      • xml, html: the response is a XML/HTML object
      • text: plain text
      • binary

    Returns Promise<any>

    a promise on the file content

remove

setCache

setPath

  • setPath(p: string): void

Protected unsupported

upload

  • Upload a file to the current directory

    Only work when the current file is a directory

    This function calls the _up function to perform the operation

    memberof

    BaseFileHandle

    Returns Promise<RequestResult>

    promise on the operation result

write

  • Write the file cache to the actual file

    This function calls the _wr function to perform the operation

    memberof

    BaseFileHandle

    Parameters

    • t: string

      data type

      • base64
      • object
      • mime type

    Returns Promise<RequestResult>

    promise on the operation result