aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/upload.ts
blob: 030a6b7d547e48ea99e44fd3eaf9eea6cd4dc6d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { METAFILE_EXTNAME } from '@uploadx/core'
import { remove } from 'fs-extra'
import { join } from 'path'
import { RESUMABLE_UPLOAD_DIRECTORY } from '../initializers/constants'

function getResumableUploadPath (filename?: string) {
  if (filename) return join(RESUMABLE_UPLOAD_DIRECTORY, filename)

  return RESUMABLE_UPLOAD_DIRECTORY
}

function deleteResumableUploadMetaFile (filepath: string) {
  return remove(filepath + METAFILE_EXTNAME)
}

// ---------------------------------------------------------------------------

export {
  getResumableUploadPath,
  deleteResumableUploadMetaFile
}