Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
const pdfParser = new PDFParser()
pdfParser.on('pdfParser_dataReady', pdfData => {
try {
const data = parsePages(pdfData.formImage.Pages)
resolve(data)
} catch (err) {
reject(err)
}
})
pdfParser.on('pdfParser_dataError', errData => reject(errData))
pdfParser.parseBuffer(pdfBuffer)
})
}