feat: implementation
This commit is contained in:
12
utils/parser.ts
Normal file
12
utils/parser.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import PdfParse from 'pdf-parse';
|
||||
|
||||
export async function parser(file: File) {
|
||||
const chunks = [];
|
||||
for await (const chunk of file.stream() as any) {
|
||||
chunks.push(chunk);
|
||||
}
|
||||
|
||||
const parsedContent = await PdfParse(Buffer.concat(chunks));
|
||||
|
||||
return parsedContent.text;
|
||||
}
|
||||
Reference in New Issue
Block a user