perplexican / src /utils /files.ts
0Scottzilla0's picture
Upload folder using huggingface_hub
a80ecb8 verified
raw
history blame contribute delete
337 Bytes
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,
};
};