# string|ArrayBuffer FileSystemManager.readFileSync(string filePath, string encoding)

The synchronous version of FileSystemManager.readFile.

# Parameters

# string filePath

The path to the file to be read.

# string encoding

Specifies the character encoding of the read file. If encoding is not specified, the binary content of the file is read in ArrayBuffer format.

Valid values of 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

# Return Values

# string|ArrayBuffer data

File content

# Errors

Error Code Error Message Description
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
点击咨询小助手