feat(utils): add files utils, remove logger, fix API url

This commit is contained in:
ItzCrazyKns
2025-03-19 13:40:35 +05:30
parent bab32e8d70
commit c46fd7a9c8
5 changed files with 18 additions and 25 deletions

17
ui/lib/utils/files.ts Normal file
View File

@ -0,0 +1,17 @@
import path from 'path';
import fs from 'fs';
export const getFileDetails = (fileId: string) => {
const fileLoc = path.join(
process.cwd(),
'./uploads',
fileId + '-extracted.json',
);
const parsedFile = JSON.parse(fs.readFileSync(fileLoc, 'utf8'));
return {
name: parsedFile.title,
fileId: fileId,
};
};