-
-
Notifications
You must be signed in to change notification settings - Fork 971
Description
Although Falcon is proud of (almost) never performing I/O behind the user's back, in some use cases it might desirable to iterate a multipart form more than once.
We could add a .spool() method to the MultipartForm class that returns a spooled object which could be iterated multiple times. Larger files would need to be saved in temporary files. Or we could use SpooledTemporaryFiles for all parts.
Ideally, the spooled object should be usable as a context manager, and it should dispose all the temporary files when exiting.
Also, the form could hold a reference to the spooled form, and delegate iteration to it upon repeated attempts. TBD whether this is a good idea.
What to do with the async side of things? Should we schedule SpooledTemporaryFile methods in an executor, or should we optionally support aiofiles?