2020-07-11 20:38:49 +00:00
|
|
|
import { FileObject } from '@/api/server/files/loadDirectory';
|
|
|
|
import http from '@/api/http';
|
|
|
|
import { rawDataToFileObject } from '@/api/transformers';
|
|
|
|
|
|
|
|
export default async (uuid: string, directory: string, files: string[]): Promise<FileObject> => {
|
2022-06-26 19:13:52 +00:00
|
|
|
const { data } = await http.post(
|
|
|
|
`/api/client/servers/${uuid}/files/compress`,
|
|
|
|
{ root: directory, files },
|
|
|
|
{
|
|
|
|
timeout: 60000,
|
|
|
|
timeoutErrorMessage:
|
|
|
|
'It looks like this archive is taking a long time to generate. It will appear once completed.',
|
2022-11-25 20:25:03 +00:00
|
|
|
},
|
2022-06-26 19:13:52 +00:00
|
|
|
);
|
2020-07-11 20:38:49 +00:00
|
|
|
|
|
|
|
return rawDataToFileObject(data);
|
|
|
|
};
|