# wx.saveFileToDisk(Object object)
Start from base library version 2.11.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.15.0
Save file system files to the user disk, only in the PC End support
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
filePath | string | yes | File path to save | |
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) |
# sample code
wx.saveFileToDisk({
filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
success(res) {
console.log(res)
},
fail(res) {
console.error(res)
}
})