Multipart parser

BáiZé provides a “bring your own I/O” multipart parser with excellent performance.

Shortcut functions

parse_stream

baize.multipart_helper.parse_stream(stream: Iterable[bytes], boundary: bytes, charset: str, *, file_factory: Type[_SyncUploadFile], max_form_parts: int = 324, max_form_memory_size: Optional[int] = None) List[Tuple[str, Union[str, _SyncUploadFile]]]

Parse a synchronous stream in multipart format

for field_name, field_or_file in parse_stream(stream, boundary, charset):
    print(field_name, field_or_file)

parse_async_stream

async baize.multipart_helper.parse_async_stream(stream: AsyncIterable[bytes], boundary: bytes, charset: str, *, file_factory: Type[_AsyncUploadFile], max_form_parts: int = 324, max_form_memory_size: Optional[int] = None) List[Tuple[str, Union[str, _AsyncUploadFile]]]

Parse an asynchronous stream in multipart format

for field_name, field_or_file in await parse_async_stream(stream, boundary, charset):
    print(field_name, field_or_file)