veqryn / go-email

Email parsing and mail creation library for golang
MIT License
95 stars 32 forks source link

Return io.Reader/io.Writer instead of reading everything #2

Open xeoncross opened 6 years ago

xeoncross commented 6 years ago

The current code reads the full body in of every part resulting in high memory usage if the email contains big attachments or many instances are running at the same time.

It would be better to build a custom io.Writer buffer or simply return the io.Reader allowing the app to decided to io.Copy, bytes.Buffer, or ReadAll as needed.