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 Entity.Reader #84

Open
emersion opened this issue Apr 24, 2020 · 1 comment · May be fixed by #112
Open

Add Entity.Reader #84

emersion opened this issue Apr 24, 2020 · 1 comment · May be fixed by #112

Comments

@emersion
Copy link
Owner

emersion commented Apr 24, 2020

Add an Entity.Reader function which returns an io.Reader for the entity. This would allow users to read a header, inspect it and then forward the reader to someone else.

Ideally this wouldn't decode and re-encode the body: we'd save the original io.Reader. That can only work if the headers aren't modified.

Bonus points if message.Read can be optimized in case it's passed the result of an Entity.Reader call (just like we have for NewMultipart and Entity.MultipartReader).

@emersion
Copy link
Owner Author

One open question is how to handle encoding/charset conversions, if at all.

Currently we allow library users to perform encoding/charset conversions by mutating the Entity.Header and using Entity.WriteTo. This won't work with Entity.Reader, because the encoding logic is io.Writer-based.

@emersion emersion linked a pull request Oct 28, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant