Home > Blockchain >  Download file from presigned url minio
Download file from presigned url minio

Time:01-18

I have a presigned url from minio which contains a pdf file. The url is valid for 24 hours. How to download the file from the url without saving into local or server and send the file as an attachment to nodemailer.

https.get(signedUrl)
     .pipe(fs.createWriteStream('sample.pdf'))
     .on('finish', function () {
      console.log('Downloaded!!');
  });

I tried this code but the file is getting save to local. Is there any way to download it without saving to local or server.

CodePudding user response:

An example using http and nodemailer

https.get(signedUrl, res => {
  transporter.sendMail({
    ..., // Other params
    attachments: [
      {
        filename: 'example.pdf',
        content: res,
      }
    ]
  });
})
  • Related