readFile(file_path, [data_type], [encoding])

Class: SwingUI.

Description:

Synchronously reads a local file and returns its data.
NOTE: Memory limit set by JavaScript runtime and operating system limits the file size that can be read.

Parameters:

Name Type Default Description

file_path

string

[data_type]

string

"string"

Desired return data type: "string", "Uint8Array", "ArrayBuffer", "Buffer". NOTE: Buffer may not be supported in all JavaScript runtimes and exception may occur.

[encoding]

string

"utf-8"

Text encoding to use. Only applies when data_type argument is "string".

Returns:

Returns the data in specified data type.

Type: string | Uint8Array | ArrayBuffer | Buffer