更新版本至 0.0.40,新增 getState 方法以获取文件状态,并扩展 Stat 类型以包含更多元数据
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kevisual/api",
|
"name": "@kevisual/api",
|
||||||
"version": "0.0.39",
|
"version": "0.0.40",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "mod.ts",
|
"main": "mod.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -156,6 +156,18 @@ export class QueryResources {
|
|||||||
|
|
||||||
return { code: 200, message: '上传成功' };
|
return { code: 200, message: '上传成功' };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getState(filepath: string, opts?: DataOpts): Promise<Result<Stat>> {
|
||||||
|
const url = `${this.prefix}${filepath}`;
|
||||||
|
return adapter({
|
||||||
|
url,
|
||||||
|
params: {
|
||||||
|
stat: '1',
|
||||||
|
},
|
||||||
|
method: 'GET' as any,
|
||||||
|
headers: this.header(opts?.headers),
|
||||||
|
});
|
||||||
|
}
|
||||||
async createFolder(folderpath: string, opts?: DataOpts): Promise<Result<any>> {
|
async createFolder(folderpath: string, opts?: DataOpts): Promise<Result<any>> {
|
||||||
const filepath = folderpath.endsWith('/') ? `${folderpath}keep.txt` : `${folderpath}/keep.txt`;
|
const filepath = folderpath.endsWith('/') ? `${folderpath}keep.txt` : `${folderpath}/keep.txt`;
|
||||||
return this.uploadFile(filepath, '文件夹占位,其他文件不存在,文件夹不存在,如果有其他文件夹,删除当前文件夹占位文件即可', opts);
|
return this.uploadFile(filepath, '文件夹占位,其他文件不存在,文件夹不存在,如果有其他文件夹,删除当前文件夹占位文件即可', opts);
|
||||||
@@ -252,3 +264,17 @@ export const getContentType = (filename: string): string => {
|
|||||||
|
|
||||||
return type;
|
return type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type Stat = {
|
||||||
|
"standardHeaders": any,
|
||||||
|
"size": string,
|
||||||
|
"etag": string,
|
||||||
|
"lastModified": string,
|
||||||
|
"metaData": {
|
||||||
|
"app-source": string,
|
||||||
|
"cache-control": string,
|
||||||
|
"content-type": string,
|
||||||
|
"share"?: string
|
||||||
|
},
|
||||||
|
"versionId": null
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user