mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-08-16 04:38:58 +00:00
feat(utils): add files utils, remove logger, fix API url
This commit is contained in:
17
ui/lib/utils/files.ts
Normal file
17
ui/lib/utils/files.ts
Normal 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,
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user