# FileSystemManager.writeFile(Object object)

Writes a file

# Parameters

# Object object

Attribute Type Default Required Description
filePath string Yes Path to the file into which you want to write data
data string/ArrayBuffer Yes Text or binary data to be written
encoding string utf8 No Specifies the character encoding of the written file
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.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 write permission on the specified filePath
点击咨询小助手