package http-multipart-formdata

  1. Overview
  2. Docs

Module Http_multipart_formdataSource

Types

Sourcetype reader
Sourceand read_result = [
  1. | `End
  2. | `Header of part_header
  3. | `Body of Cstruct.t
  4. | `Body_end
  5. | `Awaiting_input of [ `Cstruct of Cstruct.t | `Eof ] -> read_result
  6. | `Error of string
]
Sourceand input = [
  1. | `Cstruct of Cstruct.t
  2. | `Incremental
]
Sourceand part_header

Represents a parsed multipart part header data.

Sourceand boundary

Represents the multipart boundary value.

Mulipart Boundary parser

Sourceval boundary : string -> (boundary, string) result

boundary content_type parses content_type to extract boundary value. content_type is the HTTP request Content-Type header value.

Multipart Reader

Sourceval reader : ?read_buffer_size:int -> boundary -> input -> reader

reader ?read_buffer_size boundary input creates reader. The default value for read_buffer_size is 1KB.

Sourceval read_part : reader -> read_result

read_part ?read_body_len ~boundary reader reads a http multipart body and returns a read_result.

Sourceval unconsumed : reader -> Cstruct.t

Part header

Sourceval name : part_header -> string

name t returns the form field name

Sourceval content_type : part_header -> string

content_type t returns the part content-type.

Sourceval filename : part_header -> string option

filename t returns the uploaded filename is the multipart is a file

Sourceval find : string -> part_header -> string option

param_value name t returns the multipart parameter value with name name.

Pretty Printers

Sourceval pp_part_header : Format.formatter -> part_header -> unit
Sourceval pp_read_result : Format.formatter -> read_result -> unit
Sourceval pp_boundary : Format.formatter -> boundary -> unit