Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
Nestjs parse uploaded pdf to json without saving the file in the directory

I'm trying to upload a pdf file then I need to parse it using pdf2json without saving the file in the directory but pdf2json requests a directory path in loadPDF. any idea what can I do, please?

https://www.npmjs.com/package/pdf2json

@Post('getFields')
      @UseInterceptors(AzureStorageFileInterceptor('file'))
        @UploadedFile() file?: UploadedFileMetadata){
  
        if (!file || Object.keys(file).length === 0 ||file.constructor !== Object) {
            throw UtilError.createErrorError('Missing file.');
        }
        const pdfParser = new PDFParser(file);
        pdfParser.on("pdfParser_dataError", errData => console.error(errData.parserError) );
        pdfParser.on("pdfParser_dataReady", pdfData => {
            fs.writeFile(path.join(__dirname, './../../../../src/entities/skiplino/form/F1040EZ.json'), JSON.stringify(pdfData), function(){ console.log("done!") }
            );
        });
         return await pdfParser.loadPDF(./../file);
    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Just use pdfParser.parseBuffer(pdfBuffer); and pass in the file buffer.

You'll need to use the built in File Interceptor instead of the AzureStorageFileInterceptor

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!