It worked, thanks a lot Boris :)
Posts made by ChetnaNB
-
RE: Sending compressed report before sending in email
-
RE: Sending compressed report before sending in email
Hi Boris,
Thanks for quick response, I am very new to js.
I modified the code as per your suggestion, but still getting issue while trying to extract. The error is:
Cannot open the file as archive, is not archive -
Sending compressed report before sending in email
I want to compress reports before sending them as attachment in the email.
I am able to send the attachment in email by using following code, but facing issue while trying to compress them before sending. Please help.function afterRender(req, res, done) { var mailer = require('nodemailer'); var fs= require('fs'); var zlib = require('zlib'); var compress = zlib.createGzip(); var newFileName='a.gz'; /* var writeStream = fs.createWriteStream("JournalDEV.png"); writeStream.write(res.content); writeStream.end(); */ const streamifier = require('streamifier'); var writestream = fs.createWriteStream(newFileName); var vv2 = streamifier.createReadStream(res.content.buffer).pipe(writestream); const transporter = mailer.createTransport({ service: 'emailservice', auth: { user: 'sender@email.com', pass: 'SuperSecurePassword#' // naturally, replace both with your real credentials or an application-specific password } }); const mailOptions = { from: 'sender@email.com', to: 'receiver@email.com', subject: 'Sending Chrome Image reports from jsReport', text: "See the attached report", html: "<b>See the attached report</b>", attachments: [ { content: vv2 }], }; transporter.sendMail(mailOptions, function(error, info){ transporter.close(); if(error){ console.log(error); return done(error); } else { console.log('Email sent: ' + info.response); } return done(); });
}
As it can be seen in screenshot, I tried to implement it using zlib, fs, streamifier, tried various combinations to achieve it, but still facing issue in compression. Any suggestion??
-
RE: Patch Schedule API validation issue in JSReport
Thanks for looking into the matter and responding quickly.
-
Patch Schedule API validation issue in JSReport
I am using following patch API to update the data of my existing schedule.
PATCH http://jsreport-host/odata/schedules('<_id>')
BODY: {
"cron": "ree",
"templateShortid":"abds"
}While using POST Schedule API, the validation seems to be in place as it gives error for invalid cron and templateShortid values, but not in case of PATCH.
Is this an existing issue? Any suggestion how can this be resolved?