Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Goldziher/multipart-parser

Repository files navigation

Fast Multipart Parser

Starlite logo

This library includes an ultra-fast Rust based multipart parser. This parser is used by Starlite, but is developed separately - and can of course be used separately.

Discord Matrix

Installation

pip install fast-multipart-parser

Usage

The library exposes two functions parse_content_header and parse_multipart_form_data.

parse_content_header

This function is used to parse a Content-Disposition or Content-Type like header into two components - a value (string) and a parameters (dict).

from fast_multipart_parser import parse_content_header

result = parse_content_header(b"Content-Disposition: form-data; name=\"value\"")
# form-data, {"name": "value"}

Benchmarks

TODO

parse_multipart_form_data

TODO

Benchmarks

TODO

Contributing

All contributions are of course welcome!

Repository Setup

  1. Run cargo install to setup the rust dependencies and poetry install to setup the python dependencies.
  2. Install the pre-commit hooks with pre-commit install (requires pre-commit).

Building

Run poetry run maturin develop --release --strip to install a release wheel (without debugging info). This wheel can be used in tests and benchmarks.

Benchmarking

Benchmarks use pyperf. To execute them run poetry run python benchrmarks.py.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published