如何限制NodeMailer中的文件大小?
问题描述:
我发送了很多附加的pdf文件给nodemailer(如果需要,我可以提供代码)。如何限制NodeMailer中的文件大小?
现在,我需要将总发送文件的文件大小限制为10 MB,如果超过10 MB,它应发送下一封电子邮件并继续停止。
我该怎么做?
谢谢。
答
我会给你这个想法,你会写代码。问问你以后是否需要一些帮助,以及已经写好的代码。
// List all Attachments that must be sent
// For each Attachment, get the size of it using fs.statSync()
// Knowing the number of attachments and the size of each, divide them in groups where the sum of the file size of each group is less than 10MB
// Send one e-mail per group
我会尽快发布。谢谢 :) –