Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
unidocs-zh
提交
dc5126da
unidocs-zh
项目概览
DCloud
/
unidocs-zh
通知
3600
Star
108
Fork
921
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
120
列表
看板
标记
里程碑
合并请求
109
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
unidocs-zh
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
120
Issue
120
列表
看板
标记
里程碑
合并请求
109
合并请求
109
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
dc5126da
编写于
11月 29, 2023
作者:
VK1688
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update: ext-storage\dev.md
上级
7fcb2916
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
42 addition
and
6 deletion
+42
-6
docs/uniCloud/ext-storage/dev.md
docs/uniCloud/ext-storage/dev.md
+42
-6
未找到文件。
docs/uniCloud/ext-storage/dev.md
浏览文件 @
dc5126da
...
@@ -181,7 +181,7 @@ const extStorageManager = uniCloud.getExtStorageManager({
...
@@ -181,7 +181,7 @@ const extStorageManager = uniCloud.getExtStorageManager({
domain
:
"
example.com
"
,
// 域名地址
domain
:
"
example.com
"
,
// 域名地址
});
});
let
res
=
extStorageManager
.
getTempFileURL
({
let
res
=
extStorageManager
.
getTempFileURL
({
fileList
:
[
"
qiniu://test.jpg
"
],
//
私有
文件地址列表
fileList
:
[
"
qiniu://test.jpg
"
],
// 文件地址列表
});
});
console
.
log
(
'
getTempFileURL:
'
,
res
);
console
.
log
(
'
getTempFileURL:
'
,
res
);
return
res
;
return
res
;
...
@@ -191,7 +191,7 @@ return res;
...
@@ -191,7 +191,7 @@ return res;
|参数名 |类型 |必填 |默认值 |说明 |
|参数名 |类型 |必填 |默认值 |说明 |
|:-: |:-: |:-: |:-: |:-: |
|:-: |:-: |:-: |:-: |:-: |
|fileList |Array |是 |- |文件地址列表,数组内元素
格式支持(cloudPath、fileID、fileURL)
|
|fileList |Array |是 |- |文件地址列表,数组内元素
值类型支持(fileID、cloudPath、fileURL)
<br/>
如:"qiniu://test.jpg" "test.jpg" "https://example.com/test.jpg" 均表示同一个文件
|
#### 响应参数
#### 响应参数
...
@@ -207,6 +207,41 @@ return res;
...
@@ -207,6 +207,41 @@ return res;
|fileID |String |文件ID |
|fileID |String |文件ID |
|cloudPath |String |文件云端路径 |
|cloudPath |String |文件云端路径 |
### 下载文件@downloadFile
接口名:downloadFile
调用此接口获得文件Buffer
你可以在调用 extStorageManager.downloadFile 前执行一些自己的业务逻辑,判断用户是否有下载该文件权限
**云端代码**
```
js
const
extStorageManager
=
uniCloud
.
getExtStorageManager
({
provider
:
"
qiniu
"
,
domain
:
"
example.com
"
,
// 域名地址
});
let
res
=
extStorageManager
.
downloadFile
({
fileID
:
"
qiniu://test.jpg
"
,
// 待下载的文件
});
console
.
log
(
'
getTempFileURL:
'
,
res
);
return
res
;
```
#### 请求参数
|参数名 |类型 |必填 |默认值 |说明 |
|:-: |:-: |:-: |:-: |:-: |
|fileID |String |是 |- |待下载的文件,该字段支持的值类型:fileID、cloudPath、fileURL
<br/>
如:"qiniu://test.jpg" "test.jpg" "https://example.com/test.jpg" 均表示同一个文件 |
#### 响应参数
|字段 |类型 |说明 |
|:-: |:-: |:-: |
|fileContent |Buffer |下载的文件的内容 |
### 删除文件@deleteFile
### 删除文件@deleteFile
接口名:deleteFile
接口名:deleteFile
...
@@ -221,7 +256,7 @@ const extStorageManager = uniCloud.getExtStorageManager({
...
@@ -221,7 +256,7 @@ const extStorageManager = uniCloud.getExtStorageManager({
domain
:
"
example.com
"
,
// 域名地址
domain
:
"
example.com
"
,
// 域名地址
});
});
let
res
=
await
extStorageManager
.
deleteFile
({
let
res
=
await
extStorageManager
.
deleteFile
({
fileList
:
[
"
qiniu://test.jpg
"
],
//
私有
文件地址列表
fileList
:
[
"
qiniu://test.jpg
"
],
//
待删除的
文件地址列表
});
});
console
.
log
(
'
deleteFile:
'
,
res
);
console
.
log
(
'
deleteFile:
'
,
res
);
return
res
;
return
res
;
...
@@ -231,7 +266,7 @@ return res;
...
@@ -231,7 +266,7 @@ return res;
|参数名 |类型 |必填 |默认值 |说明 |
|参数名 |类型 |必填 |默认值 |说明 |
|:-: |:-: |:-: |:-: |:-: |
|:-: |:-: |:-: |:-: |:-: |
|fileList |Array |是 |- |文件地址列表,数组内元素
格式支持(cloudPath、fileID、fileURL)
|
|fileList |Array |是 |- |文件地址列表,数组内元素
值类型支持(fileID、cloudPath、fileURL)
<br/>
如:"qiniu://test.jpg" "test.jpg" "https://example.com/test.jpg" 均表示同一个文件
|
#### 响应参数
#### 响应参数
...
@@ -255,7 +290,7 @@ const extStorageManager = uniCloud.getExtStorageManager({
...
@@ -255,7 +290,7 @@ const extStorageManager = uniCloud.getExtStorageManager({
domain
:
"
example.com
"
,
// 域名地址
domain
:
"
example.com
"
,
// 域名地址
});
});
let
res
=
await
extStorageManager
.
updateFileStatus
({
let
res
=
await
extStorageManager
.
updateFileStatus
({
fileID
:
"
qiniu://test.jpg
"
,
//
私有文件id
fileID
:
"
qiniu://test.jpg
"
,
//
待修改的文件
isPrivate
:
true
,
// true 私有 false 公共
isPrivate
:
true
,
// true 私有 false 公共
});
});
console
.
log
(
'
updateFileStatus:
'
,
res
);
console
.
log
(
'
updateFileStatus:
'
,
res
);
...
@@ -266,9 +301,10 @@ return res;
...
@@ -266,9 +301,10 @@ return res;
|参数名 |类型 |必填 |默认值 |说明 |
|参数名 |类型 |必填 |默认值 |说明 |
|:-: |:-: |:-: |:-: |:-: |
|:-: |:-: |:-: |:-: |:-: |
|fileID |String |是 |- |待修改的文件,
支持(cloudPath、fileID、fileURL)
|
|fileID |String |是 |- |待修改的文件,
该字段支持的值类型:fileID、cloudPath、fileURL
<br/>
如:"qiniu://test.jpg" "test.jpg" "https://example.com/test.jpg" 均表示同一个文件
|
|isPrivate|Boolean|是 |- |true 设为私有权限 false 设为公共读权限 |
|isPrivate|Boolean|是 |- |true 设为私有权限 false 设为公共读权限 |
#### 响应参数
#### 响应参数
|字段 |类型 |说明 |
|字段 |类型 |说明 |
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录