Skip to content

Commit 6f33208

Browse files
authored
feat(File): set file key manually (#638)
1 parent 484030a commit 6f33208

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/file.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ module.exports = function(AV) {
485485
const data = {
486486
name,
487487
keep_file_name: authOptions.keepFileName,
488+
key: authOptions.key,
488489
ACL: this._acl,
489490
mime_type: type,
490491
metaData: this.attributes.metaData,
@@ -501,6 +502,7 @@ module.exports = function(AV) {
501502
* @param {AuthOptions} [options] AuthOptions plus:
502503
* @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
503504
* @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
505+
* @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
504506
* @return {Promise} Promise that is resolved when the save finishes.
505507
*/
506508
save(options = {}) {

storage.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ interface CaptchaOptions {
5252

5353
interface FileSaveOptions extends AuthOptions {
5454
keepFileName?: boolean;
55+
key?: string;
5556
onprogress?: (event: {
5657
loaded: number;
5758
total: number;

0 commit comments

Comments
 (0)