mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-06-21 01:08:33 +00:00
feat(app): add file uploads
This commit is contained in:
16
src/utils/files.ts
Normal file
16
src/utils/files.ts
Normal file
@ -0,0 +1,16 @@
|
||||
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