Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
c6243f77
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6007
Star
91
Fork
164
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
c6243f77
编写于
4月 22, 2024
作者:
W
WOSHIMAHAIFENG
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改file测试示例
上级
086d6d26
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
56 addition
and
51 deletion
+56
-51
pages/API/get-file-system-manager/get-file-system-manager.uvue
.../API/get-file-system-manager/get-file-system-manager.uvue
+56
-51
static/filemanager/1.txt.br
static/filemanager/1.txt.br
+0
-0
未找到文件。
pages/API/get-file-system-manager/get-file-system-manager.uvue
浏览文件 @
c6243f77
...
@@ -483,7 +483,7 @@
...
@@ -483,7 +483,7 @@
console.log("success to readdir", res)
console.log("success to readdir", res)
res.files.forEach(element => {
res.files.forEach(element => {
console.log(element)
console.log(element)
let filePath
:
string
let filePath
:
string
if (this.rmDirFile.length <= 0) {
if (this.rmDirFile.length <= 0) {
filePath = `${this.basePath}${element}`
filePath = `${this.basePath}${element}`
} else {
} else {
...
@@ -786,20 +786,23 @@
...
@@ -786,20 +786,23 @@
}
}
},
},
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()
fileManager.unzip({
fileManager.unzip({
zipFilePath: `${this.basePath}${this.unzipFile}`
,
zipFilePath: res.tempFilePath
,
targetPath: `${this.basePath}${this.targetZip}`,
targetPath: `${this.basePath}${this.targetZip}`,
success: (res : FileManagerSuccessResult) => {
success: (res : FileManagerSuccessResult) => {
if (this.logAble) {
if (this.logAble) {
this.log += 'save
FileTest success:' + JSON.stringify(res) + '\n\n'
this.log += 'unzip
FileTest success:' + JSON.stringify(res) + '\n\n'
}
}
console.log('success', res)
console.log('success', res)
},
},
fail: (res : UniError) => {
fail: (res : UniError) => {
if (this.logAble) {
if (this.logAble) {
this.log += 'save
FileTest fail:' + JSON.stringify(res) + '\n\n'
this.log += 'unzip
FileTest fail:' + JSON.stringify(res) + '\n\n'
}
}
console.log('fail', res)
console.log('fail', res)
this.lastFailError = res
this.lastFailError = res
...
@@ -809,6 +812,11 @@
...
@@ -809,6 +812,11 @@
}
}
} as UnzipFileOptions)
} as UnzipFileOptions)
},
},
fail: (e) => {
console.log(e)
}
})
},
getSavedFileListTest: function () {
getSavedFileListTest: function () {
const fileManager = uni.getFileSystemManager()
const fileManager = uni.getFileSystemManager()
...
@@ -881,7 +889,7 @@
...
@@ -881,7 +889,7 @@
readCompressedFileTest() {
readCompressedFileTest() {
const fileManager = uni.getFileSystemManager()
const fileManager = uni.getFileSystemManager()
fileManager.readCompressedFile({
fileManager.readCompressedFile({
filePath:
`${this.basePath}${this.brFile}`
,
filePath:
'/static/filemanager/1.txt.br'
,
compressionAlgorithm: "br",
compressionAlgorithm: "br",
success: (res : ReadCompressedFileResult) => {
success: (res : ReadCompressedFileResult) => {
if (this.logAble) {
if (this.logAble) {
...
@@ -906,7 +914,7 @@
...
@@ -906,7 +914,7 @@
const fileManager = uni.getFileSystemManager()
const fileManager = uni.getFileSystemManager()
try {
try {
let data = fileManager.readCompressedFileSync(
let data = fileManager.readCompressedFileSync(
`${this.basePath}${this.brFile}`
,
'/static/filemanager/1.txt.br'
,
"br")
"br")
if (this.logAble) {
if (this.logAble) {
this.log += data
this.log += data
...
@@ -1224,25 +1232,17 @@
...
@@ -1224,25 +1232,17 @@
}
}
},
},
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: `${this.basePath}${this.readZipFile}`
,
filePath: res.tempFilePath
,
encoding: 'utf-8',
encoding: 'utf-8',
entries: [{
path: 'kkkk',
encoding: 'utf-8'
} as EntryItem,
{
path: 'log/log1.txt',
encoding: 'utf-8'
} as EntryItem,
{
path: 'hello.txt',
encoding: 'utf-8'
} as EntryItem],
success: (res : EntriesResult) => {
success: (res : EntriesResult) => {
if (this.logAble) {
if (this.logAble) {
this.log += 'readZipEntry success:' + JSON.stringify(res)
+ '\n\n'
this.log += 'readZipEntry success:size=' + res.result.size
+ '\n\n'
}
}
console.log("success", res)
console.log("success", res)
},
},
...
@@ -1255,6 +1255,11 @@
...
@@ -1255,6 +1255,11 @@
}
}
} as ReadZipEntryOptions)
} as ReadZipEntryOptions)
},
},
fail: (e) => {
console.log(e)
}
})
},
},
},
...
...
static/filemanager/1.txt.br
0 → 100644
浏览文件 @
c6243f77
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录