I am making a request with an .xlsx file to the server, the server is generating a PDF with puppeteer, and I want to send the stream back to the client in an array to download them, but the response is not awaiting them and in the front I get an empty array.
Node.js/Reactjs
router.post('/generate-payslip', async (req, res) => {
  const data = JSON.parse(req.body)
  let responsePDF = []
  data.map(async data => {
    responsePDF.push(await generatePayslipPDF(data))
    const payslips = await Payslip.findOne({ date: data.Date, name: data.Name })
    if (payslips) {
    } else {
      let payslip = new Payslip({
        date: data.Date,
        name: data.Name,
        data: data
      })
      payslip = await payslip.save()
    }
  })
  res.send(responsePDF)
})