FileSystemManager.readFile(Object object)
Reads local file content.
Parameters
Object object
Attribute | Type | Default | Required | Description |
filePath | string | | Yes | Path to the file to be read |
encoding | string | | No | Specifies the character encoding of the read file. If encoding is not specified, the binary content of the file is read in ArrayBuffer format |
success | function | | No | The callback function for a successful API call |
fail | function | | No | Callback function for failed API call |
complete | function | | No | Callback function used when API call completed (always executed whether call succeeds or fails) |
Valid values of object.encoding
Value | Description | Minimum Version |
ascii | | |
base64 | | |
binary | | |
hex | | |
ucs2 | Read in little endian | |
ucs-2 | Read in little endian | |
utf16le | Read in little endian | |
utf-16le | Read in little endian | |
utf-8 | | |
utf8 | | |
latin1 | | |
object.success callback function
Parameters
Object res
Property | Type | Description |
data | string/ArrayBuffer | File content |
object.fail callback function
Parameters
Object res
Property | Type | Description |
errMsg | string | Error message |
Valid values of res.errMsg
Value | Description | Minimum Version |
fail no such file or directory, open ${filePath} | The directory where the specified filePath is located does not exist | |
fail permission denied, open ${dirPath} | No read permission on the specified filePath | |