提交 2287d51d 编写于 作者: WOSHIMAHAIFENG's avatar WOSHIMAHAIFENG

Merge branch 'alpha-filenew' into 'alpha'

修改压缩示例

See merge request !35
...@@ -786,13 +786,14 @@ ...@@ -786,13 +786,14 @@
} }
}, },
unzipFileTest: function (_ : any) { unzipFileTest: function (_ : any) {
uni.downloadFile({
url: 'https://b2c-store.oss-ap-southeast-1.aliyuncs.com/ceshi/FRT.zip',
success: (res) => {
console.log(res)
const fileManager = uni.getFileSystemManager() const fileManager = uni.getFileSystemManager()
try {
fileManager.mkdirSync(`${this.basePath}${this.targetZip}`, true)
} catch (e) {
console.error(e)
}
fileManager.unzip({ fileManager.unzip({
zipFilePath: res.tempFilePath, zipFilePath: '/static/filemanager/to.zip',
targetPath: `${this.basePath}${this.targetZip}`, targetPath: `${this.basePath}${this.targetZip}`,
success: (res : FileManagerSuccessResult) => { success: (res : FileManagerSuccessResult) => {
if (this.logAble) { if (this.logAble) {
...@@ -812,11 +813,6 @@ ...@@ -812,11 +813,6 @@
} }
} as UnzipFileOptions) } as UnzipFileOptions)
}, },
fail: (e) => {
console.log(e)
}
})
},
getSavedFileListTest: function () { getSavedFileListTest: function () {
const fileManager = uni.getFileSystemManager() const fileManager = uni.getFileSystemManager()
...@@ -1233,13 +1229,9 @@ ...@@ -1233,13 +1229,9 @@
} }
}, },
readZipEntry() { readZipEntry() {
uni.downloadFile({
url: 'https://b2c-store.oss-ap-southeast-1.aliyuncs.com/ceshi/FRT.zip',
success: (res) => {
console.log(res)
const fileManager = uni.getFileSystemManager() const fileManager = uni.getFileSystemManager()
fileManager.readZipEntry({ fileManager.readZipEntry({
filePath: res.tempFilePath, filePath: '/static/filemanager/to.zip',
encoding: 'utf-8', encoding: 'utf-8',
success: (res : EntriesResult) => { success: (res : EntriesResult) => {
if (this.logAble) { if (this.logAble) {
...@@ -1256,11 +1248,6 @@ ...@@ -1256,11 +1248,6 @@
} }
} as ReadZipEntryOptions) } as ReadZipEntryOptions)
}, },
fail: (e) => {
console.log(e)
}
})
},
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册