-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Expand file tree
/
Copy pathfiles.ts
More file actions
130 lines (99 loc) · 4.02 KB
/
files.ts
File metadata and controls
130 lines (99 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import { File } from '@/api/interface/file';
import http from '@/api';
import { AxiosRequestConfig } from 'axios';
import { ResPage } from '../interface';
import { TimeoutEnum } from '@/enums/http-enum';
import { ReqPage } from '@/api/interface';
export const getFilesList = (params: File.ReqFile) => {
return http.post<File.File>('files/search', params, TimeoutEnum.T_5M);
};
export const getUploadList = (params: File.SearchUploadInfo) => {
return http.post<ResPage<File.UploadInfo>>('files/upload/search', params);
};
export const getFilesTree = (params: File.ReqFile) => {
return http.post<File.FileTree[]>('files/tree', params);
};
export const createFile = (form: File.FileCreate) => {
return http.post<File.File>('files', form);
};
export const deleteFile = (form: File.FileDelete) => {
return http.post<File.File>('files/del', form);
};
export const batchDeleteFile = (form: File.FileBatchDelete) => {
return http.post('files/batch/del', form);
};
export const changeFileMode = (form: File.FileCreate) => {
return http.post<File.File>('files/mode', form);
};
export const compressFile = (form: File.FileCompress) => {
return http.post<File.File>('files/compress', form, TimeoutEnum.T_10M);
};
export const deCompressFile = (form: File.FileDeCompress) => {
return http.post<File.File>('files/decompress', form, TimeoutEnum.T_10M);
};
export const getFileContent = (params: File.ReqFile) => {
return http.post<File.File>('files/content', params);
};
export const saveFileContent = (params: File.FileEdit) => {
return http.post<File.File>('files/save', params);
};
export const checkFile = (path: string) => {
return http.post<boolean>('files/check', { path: path });
};
export const uploadFileData = (params: FormData, config: AxiosRequestConfig) => {
return http.upload<File.File>('files/upload', params, config);
};
export const chunkUploadFileData = (params: FormData, config: AxiosRequestConfig) => {
return http.upload<File.File>('files/chunkupload', params, config);
};
export const renameRile = (params: File.FileRename) => {
return http.post<File.File>('files/rename', params);
};
export const changeOwner = (params: File.FileOwner) => {
return http.post<File.File>('files/owner', params);
};
export const wgetFile = (params: File.FileWget) => {
return http.post<File.FileWgetRes>('files/wget', params);
};
export const moveFile = (params: File.FileMove) => {
return http.post<File.File>('files/move', params, TimeoutEnum.T_5M);
};
export const downloadFile = (params: File.FileDownload) => {
return http.download<BlobPart>('files/download', params, { responseType: 'blob', timeout: TimeoutEnum.T_40S });
};
export const computeDirSize = (params: File.DirSizeReq) => {
return http.post<File.DirSizeRes>('files/size', params, TimeoutEnum.T_5M);
};
export const fileWgetKeys = () => {
return http.get<File.FileKeys>('files/wget/process/keys');
};
export const getRecycleList = (params: ReqPage) => {
return http.post<ResPage<File.RecycleBin>>('files/recycle/search', params);
};
export const reduceFile = (params: File.RecycleBinReduce) => {
return http.post<any>('files/recycle/reduce', params);
};
export const clearRecycle = () => {
return http.post<any>('files/recycle/clear');
};
export const searchFavorite = (params: ReqPage) => {
return http.post<ResPage<File.Favorite>>('files/favorite/search', params);
};
export const addFavorite = (path: string) => {
return http.post<any>('files/favorite', { path: path });
};
export const readByLine = (req: File.FileReadByLine) => {
return http.post<any>('files/read', req);
};
export const removeFavorite = (id: number) => {
return http.post<any>('files/favorite/del', { id: id });
};
export const batchChangeRole = (params: File.FileRole) => {
return http.post<any>('files/batch/role', params);
};
export const getRecycleStatus = () => {
return http.get<string>('files/recycle/status');
};
export const getPathByType = (pathType: string) => {
return http.get<string>(`files/path/${pathType}`);
};