refactor: load project

This commit is contained in:
Carlos Valente
2024-07-02 16:52:18 +02:00
committed by Carlos Valente
parent 9c5e403b18
commit 751c3329f0
11 changed files with 153 additions and 87 deletions
+1 -13
View File
@@ -1,11 +1,10 @@
import multer from 'multer';
import path from 'path';
import fs from 'fs';
import { rename, rm } from 'fs/promises';
import { 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));
@@ -69,14 +68,3 @@ 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);
}