# FileSystemManager.appendFile(Object object)

Start from base library version 2.1.0. Please remaining backward compatible.

with Promise style call: Not supported

Mini Program plugin: Support, need to Mini Program base library version no less than 2.19.2

Append content at the end of the file

# parameter

# Object object

attribute type Default values Required Introductions
filePath string yes File path to append content (Local path)
data string/ArrayBuffer yes Text or binary data to append
encoding string utf8 no Specifies the character encoding for writing to the file
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)

object.encoding Legal value

value Introductions Minimum version
ucs2 Read in small endorder
ucs-2 Read in small endorder
Utf16le Read in small endorder
utf-16le Read in small endorder

# object.fail callback

# parameter
# Object res
attribute type Introductions
errMsg string Error message

res.errMsg Legal value

value Introductions Minimum version
fail No such file or directory, open ${filePath} Specified filePath File does not exist
fail illegal operation on a directory, open "${filePath}" Specified filePath It's an existing directory.
fail permission denied, open ${dirPath} Specified filePath Path does not have write permissions
fail sdcard not mounted Android sdcard Mount failure

# sample code

const fs = wx.getFileSystemManager()

  filePath: `${wx.env.USER_DATA_PATH}/hello.txt`, 
  data: 'some text',
  encoding: 'utf8',
  success(res) {
  fail(res) {

// Synchronous interface
try {
  fs.appendFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`,  'some text', 'utf8')
} catch(e) {