Skip to content

Scripting API / core/FileApi

core/FileApi

Modules

Module Description
External -

Classes

FileApi

Methods

create()

create(options): Promise<number>

Creates a new File.

Parameters
Parameter Type Description
options FileCreateOptions Options to create the File.
Returns

Promise<number>

delete()

delete(id): Promise<void>

Deletes a File.

Parameters
Parameter Type Description
id number The id of the File to delete.
Returns

Promise<void>

getInfo()

getInfo(id): Promise<SingleFile>

Retrieves information for an existing File. Throws an error if the File does not exist.

Parameters
Parameter Type Description
id number The id of the File to retrieve.
Returns

Promise<SingleFile>

openFileDialog()

openFileDialog(): Promise<FileContents>

Opens a local file picker to allow the user to choose a file.

Returns

Promise<FileContents>

The contents of the file chosen by the user. All properties will be undefined if the user cancels the overlay.

read()

read(id): Promise<Blob>

Retrieves the contents of an existing File. Throws an error if the File does not exist.

Parameters
Parameter Type Description
id number The id of the File to retrieve.
Returns

Promise<Blob>

The contents of the File as a Blob.

update()

update(id, options): Promise<void>

Updates a File.

Parameters
Parameter Type Description
id number The id of the File to update.
options FileUpdateOptions Options to update the File.
Returns

Promise<void>