-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 Field::chunk
#901
Add Field::chunk
#901
Conversation
This fixes not being able to stream data from a multipart directly into a file or other output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to add as convenience even though it's the same as the Stream
impl.
Field::chunk
@davidpdrsn missed a formatting issue in the initial pr cuasing cli to fail. it is fixed now but needs further approval. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more nitpicks.
Wanna add a changelog entry as well?
I've cleaned up the docs just now so should be good now 😊 I've also noticed that we use |
Thanks! |
Added the function
chunk
forexum::extract's multipart Field
to give a clearer option to use rather than try_next.Motivation
I needed a way to stream large files from a frontend file uploader directly into a file. These files can be 10gb+ in size, and need to be paused at any time. Though this is doable with try_next, I felt that it was clearer from the user's side to have chunk.
Solution
By implementing the
chunk
function foraxum::extract's multipart Field
, readability of code and nicer access the underlying multer::Field'schunk
funciton is allowed.Change log
&self
to&mut self