Module multipart

The module implements asynchronous handling of the multipart messages.

Types

MultiPartMessage* = ref object
  s: AsyncStream
  ct: ContentType
  preambleFinished: bool
  finished: bool
  boundary: string
The multipart message   Source Edit
MessagePart* = ref object
  msg: MultiPartMessage
  h: Props
  ct: ContentType
  cd: ContentDisposition
  enc: string
  cl: int
The body part of the multipart message   Source Edit

Procs

proc open*(t: typedesc[MultiPartMessage]; s: AsyncStream; contentType: ContentType): MultiPartMessage
Opens multipart message with contentType for reading from stream s.   Source Edit
proc atEnd*(m: MultiPartMessage): bool
Checks if there is no more body parts in the message m. This can be detected only after the call of readNextPart that returned nil.   Source Edit
proc readNextPart*(m: MultiPartMessage): Future[MessagePart] {.
async
.}
Returns the next part of the message m or nil if it's ended   Source Edit
proc getPartDataStream*(p: MessagePart): AsyncStream
Returns the body part as asynchronous stream.   Source Edit
proc headers*(p: MessagePart): Props
Returns http headers of the multipart message part p   Source Edit
proc encoding*(p: MessagePart): string
Returns the encoding of the multipart message part p   Source Edit
proc contentType*(p: MessagePart): ContentType
Returns the content type of the multipart message part p   Source Edit
proc contentDisposition*(p: MessagePart): ContentDisposition
Returns the content disposition of the multipart message part p   Source Edit