4

I haven't worked with mime encoding before, this is my first time. Sorry if you feel this question is too basic.

I am trying to generate a mime file, which later will be can pass to email clients. Currently, I am using this library to encode my content. I am calling quotedPrintableEncode function to encode my content.

I have run some tests and the encoder is working fine. The only concern is the speed of the encoder which is average 300ms per email on my PC. The code will be deployed on AWS-lambda, so it's not ideal to do processing in lambda functions.

Is there any better library? Is there any optimization that can be done to bring it to at least 100ms?

Feel free to ask if you have any questions. Thanks.

asfandahmed1
  • 462
  • 5
  • 23

1 Answers1

-1

According to my experience, a lot of JS performance optimization can already be done by general measures like optimizing reading and writing procedures, minimize the amount of libraries used etc. There are also tools for optimization like the V8 engine.

If you have a chance to avoid javascript and outsource your MIME batch processing to an other language - go for that option. A possible candidate are the MIME tools, but there are other alternatives in different programming languages. If you are under Linux, you could use ready available command-line tools like reformime. I am sure there are also ways to do that using Powershell since MIME encoding is such an abundant task, I found e.g. https://www.example-code.com/powershell/mime_content_transfer_encoding.asp but I have not tested that.

EDIT. There is also https://www.npmjs.com/package/mime - but maybe you do not need full-fledged MIME encoding, maybe base64 encoding is enough (or at least the slow part)?

B--rian
  • 5,578
  • 10
  • 38
  • 89