mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 10:53:51 +00:00
refactor: project service boundaries
This commit is contained in:
committed by
Carlos Valente
parent
20d9df2501
commit
ad69c0ff80
@@ -1,10 +1,11 @@
|
||||
import multer from 'multer';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { rm } from 'fs/promises';
|
||||
import { rename, rm } from 'fs/promises';
|
||||
|
||||
import { ensureDirectory } from './fileManagement.js';
|
||||
import { getAppDataPath, uploadsFolderPath } from '../setup/index.js';
|
||||
import { deleteFile } from './parserUtils.js';
|
||||
|
||||
function generateNewFileName(filePath: string, callback: (newName: string) => void) {
|
||||
const baseName = path.basename(filePath, path.extname(filePath));
|
||||
@@ -68,3 +69,14 @@ export async function clearUploadfolder() {
|
||||
// we dont care that there was no folder
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies a file from upload folder to a destination
|
||||
* @param filePath
|
||||
* @param name
|
||||
* @returns
|
||||
*/
|
||||
export async function moveUploadedFile(fromUpload: string, toDestination: string) {
|
||||
await rename(fromUpload, toDestination);
|
||||
await deleteFile(fromUpload);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user