For anyone else using the nodejs-client and want to save the pdf to disk instead of passing it through the response object in express, here's a snippet to help out.
Im not familliar with streams so this took me a while to get it right. I hope this helps someone :D
response.body(function(body){ fs.writeFile('hello.pdf', body, function(err){ if (err) console.log(err) res.send('ok') }) })Wow you can even put the stream directly to the mail object for nodemailer
response.body(function(body){ var mail = { from: "Jan Blaha <test@gmail.com>", to: data.sendTo, subject: "Sending email from node.js", text: "See the attached report", html: "<b>See the attached report</b>", attachments: [ { filename: 'Report.pdf', content: body }], } smtpTransport.sendMail(mail, function(error, response){ smtpTransport.close(); if(error){ console.log(error) } res.send('ok') }); })thanks Jan