Skip to content

Ability to spool multipart form to temporary files #2522

@vytas7

Description

@vytas7

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions