Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add io.Reader interface for attachment content #296

Merged
merged 3 commits into from
Aug 7, 2023

Conversation

erankor
Copy link
Contributor

@erankor erankor commented Jul 23, 2023

can provide a significant optimization in memory usage when encoding large attachments - the attachment is stored only once (in the final message), instead of 3 times (part.Content, the base64 encoded buffer and the final message)

can provide a significant optimization in memory usage when encoding
large attachments - the attachment is stored only once (in the final
message), instead of 3 times (part.Content, the base64 encoded buffer
and the final message)
@coveralls
Copy link

coveralls commented Jul 23, 2023

Coverage Status

coverage: 85.955% (-0.2%) from 86.167% when pulling 092a99b on erankor:main into 9d622b5 on jhillyerd:main.

Copy link
Owner

@jhillyerd jhillyerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. One concern I have is that the builder was designed to be safe to "fork" in the sense that it always returns a copy of itself. ie you could setup the content, store that copy, then loop over your recipients, adding each one and sending the returned copy.

I suspect storing a content reader would mean only the first use of any particular set of copies would function, and the rest would just see an EOF. Not the end of the world, but I think it needs to be called out in the builder doc comment.

encode.go Outdated Show resolved Hide resolved
encode_test.go Show resolved Hide resolved
encode_test.go Outdated Show resolved Hide resolved
@erankor
Copy link
Contributor Author

erankor commented Jul 26, 2023

Thanks @jhillyerd! added the requested comments

@erankor
Copy link
Contributor Author

erankor commented Aug 6, 2023

ping :)

@jhillyerd jhillyerd merged commit 151d2dc into jhillyerd:main Aug 7, 2023
5 checks passed
@jhillyerd
Copy link
Owner

Looks good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants