diff options
Diffstat (limited to 'server/helpers/upload.ts')
-rw-r--r-- | server/helpers/upload.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/server/helpers/upload.ts b/server/helpers/upload.ts new file mode 100644 index 000000000..030a6b7d5 --- /dev/null +++ b/server/helpers/upload.ts | |||
@@ -0,0 +1,21 @@ | |||
1 | import { METAFILE_EXTNAME } from '@uploadx/core' | ||
2 | import { remove } from 'fs-extra' | ||
3 | import { join } from 'path' | ||
4 | import { RESUMABLE_UPLOAD_DIRECTORY } from '../initializers/constants' | ||
5 | |||
6 | function getResumableUploadPath (filename?: string) { | ||
7 | if (filename) return join(RESUMABLE_UPLOAD_DIRECTORY, filename) | ||
8 | |||
9 | return RESUMABLE_UPLOAD_DIRECTORY | ||
10 | } | ||
11 | |||
12 | function deleteResumableUploadMetaFile (filepath: string) { | ||
13 | return remove(filepath + METAFILE_EXTNAME) | ||
14 | } | ||
15 | |||
16 | // --------------------------------------------------------------------------- | ||
17 | |||
18 | export { | ||
19 | getResumableUploadPath, | ||
20 | deleteResumableUploadMetaFile | ||
21 | } | ||