# FileSystemManager.copyFileSync(string srcPath, string destPath)

with Promise style call: Not supported

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

FileSystemManager.copyFile The synchronous version of

# parameter

# string srcPath

Source file path, support local path

# string destPath

Destination file path, local path support

# error

Error code Error message Introductions
fail permission denied, copyFile ${srcPath} -> ${destPath} Specify destination file path without write permissions
fail No such file or directory, copyFile ${srcPath} -> ${destPath} The source file does not exist or the upper directory of the destination file path does not exists
fail the maximum size of the file storage limit is exceeded Insufficient storage space
fail sdcard not mounted Android sdcard Mount failure

# sample code

const fs = wx.getFileSystemManager()
fs.copyFile({
  srcPath: `${wx.env.USER_DATA_PATH}/hello.txt`, 
  destPath: `${wx.env.USER_DATA_PATH}/hello_copy.txt`
  success(res) {
    console.log(res)
  },
  fail(res) {
    console.error(res)
  }
})

// Synchronous interface
try {
  fs.copyFileSync(
    `${wx.env.USER_DATA_PATH}/hello.txt`, 
    `${wx.env.USER_DATA_PATH}/hello_copy.txt`
  )
} catch(e) {
  console.error(e)
}