# FileSystemManager.unzip(Object object)
with Promise style call: Not supported
Mini Program plugin: Support, need to Mini Program base library version no less than 2.19.2
Decompress file
# parameter
# Object object
attribute | type | Default values | Required | Introductions |
---|---|---|---|---|
zipFilePath | string | yes | Source file path, support local path, It can only be zip Compressed file | |
targetPath | string | yes | Destination directory path, Support local path | |
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.fail callback
# parameter
# Object res
attribute | type | Introductions |
---|---|---|
errMsg | string | Error message |
res.errMsg Legal value
value | Introductions | Minimum version |
---|---|---|
fail permission denied, unzip ${zipFilePath} -> ${destPath} | Specify destination file path without write permissions | |
fail No such file or directory, unzip ${zipFilePath} -> "${destPath} | The source file does not exist or the upper directory of the destination file path does not exists |
# sample code
const fs = wx.getFileSystemManager()
fs.unzip({
zipFilePath: `${wx.env.USER_DATA_PATH}/example.zip`,
targetPath: '${wx.env.USER_DATA_PATH}/example',
success(res) {
console.log(res)
},
fail(res) {
console.error(res)
}
})
The translations are provided by WeChat Translation and are for reference only. In case of any inconsistency and discrepancy between the Chinese version and the English version, the Chinese version shall prevail.Incorrect translation. Tap to report.