ICouch v0.1.0 ICouch.Multipart View Source
Module for handling multipart streams.
Used internally, but can be used in other applications.
Link to this section Summary
Functions
Reads the subtype and boundary from a multipart/* content type header, if found
Joins all given parts into one multipart stream
Joins a part to form a chunk of multipart stream data
Splits an entire multipart stream into its parts
Splits the incoming data up if a boundary was found. Also expects and extracts the header
Link to this section Functions
Reads the subtype and boundary from a multipart/* content type header, if found.
Joins all given parts into one multipart stream.
Joins a part to form a chunk of multipart stream data.
According to specification, each part ends with a line break after the data.
split(data :: binary, boundary :: binary) :: {:ok, parts :: [{headers :: map, body :: binary}]} | :error
Splits an entire multipart stream into its parts.
Returns error if the stream is incomplete.
split_part(data :: binary, boundary :: binary) :: {previous :: binary, next_headers :: map | nil, rest :: binary | nil}
Splits the incoming data up if a boundary was found. Also expects and extracts the header.
Return values:
previous
- data which belongs to the previous part, ready to be used; can be emptynext_headers
- if not nil, a new part has been found; can be an empty maprest
- data which might belong to the next part or is uncertain; nil when an end boundary has been found