Skip to content

IO

Defined in: util/io.ts:9

new IO(): IO

IO

static _callback: object = {}

Defined in: util/io.ts:147


static _proxyCallback: object = {}

Defined in: util/io.ts:149


static _remoteCallback: object = {}

Defined in: util/io.ts:148

static _finalCallback(message): Promise<unknown>

Defined in: util/io.ts:195

string

Promise<unknown>


static getFileContent(path): Promise<string>

Defined in: util/io.ts:24

param: (path: string)

return: Promise<string>

Returns a base-64 encoded string of the target file’s contents. UTF-8 encoded files may be decoded through:

IO.getFileContent('C:\\text.txt').then(function(base64Content) {
var actualContent = decodeURIComponent(escape(window.atob(base64Content));
});

string

Promise<string>


static getVideoDuration(file): Promise<unknown>

Defined in: util/io.ts:159

param: (file: string)

return: Promise

Returns the duration of a video file on the local system, specified in units of 10^-7 seconds.

any

Promise<unknown>


static getWebContent(url): Promise<string>

Defined in: util/io.ts:46

param: (url: string)

return: Promise<string>

Returns a base-64 encoded string of the target endpoint’s contents. Redirects are resolved, and this bypasses access-control-allow-origin.

UTF-8 encoded content may be decoded through:

IO.getWebContent('http://example.com').then(function(base64Content) {
var actualContent = decodeURIComponent(escape(window.atob(base64Content));
});

string

Promise<string>


static openFileDialog(optionBag?, filter?): Promise<string[]>

Defined in: util/io.ts:93

param: ([options] [, filter]) – see below

return: Promise<string[]>

Opens a file dialog for the user to select a file (or multiple files). Resolves with an array of strings, each of which contains the full path and filename of a selected file. Rejects when the dialog is canceled.

The first (optional) argument is a JSON object that can be used to indicate that certain flags should be true. These are documented as follows:

  • allowMultiSelect: allows users to select multiple files.
  • fileMustExist: prevents users from typing a name of a nonexistent file
  • forceShowHidden: lets the dialog show files marked as System or Hidden (but not both)

The second argument (also optional) is a JSON object used to specify the filter for items to be displayed. It takes two members:

  • name: the description of the filter (for example: Image Files)
  • extensions: an array of file extensions (for example: ['jpg','bmp']);

boolean

boolean

boolean

string[]

boolean

Promise<string[]>


static openUrl(url): Promise<string>

Defined in: util/io.ts:60

param: (url: string)

Opens a URL in the user’s default browser. URL must specify HTTP or HTTPS.

string

Promise<string>