Skip to content

You're viewing documentation for a pre-release version. View the latest stable version

Instance Method

parse(_:)

Synchronously parse the multipart data into an array of MultipartPart.
func parse(_ data: Body) throws(MultipartParserError) -> [MultipartPart<Body>]

Parameters

data

The complete multipart message.

Return Value

The parts of the message, in the order they appeared.

Discussion

The whole message must be present in data. Every part is held in memory at once, so prefer StreamingMultipartParserAsyncSequence for large messages such as file uploads.

Throws

MultipartParserError if the message is malformed, or unexpectedEndOfFile if it is incomplete.