mboxrd-parse
mboxrd-parse/ port
Version: 4.1.5.1

The "mboxrd-read" Tool

This is a library of one function (with two front doors) that parse mboxrd files into lazy lists of messages.

 (require (planet clements/mboxrd-read))

(mboxrd-parse path)
  (lazy-listof (list/c bytes? (promise/c bytes?)))
  path : path?

Given a path to an mbox file, return a lazy list of the messages in the file. Each file is represented as a list containing a byte-string representing the header and the promise of a byte-string representing the body. These byte-strings can be appended to obtain the original message except that every \n in the original is replaced by \r\n to match the RFC 2822 format.

(mboxrd-parse/port port)
  (lazy-listof (list/c bytes? (promise/c bytes?)))
  port : port?

Similar to mboxrd-read, but operates on a port rather than on a path. Note that this procedure assumes that it’s the only one reading the port. Bad stuff will happen if its not; it doesn’t leave the "From " of the next message on the stream. This procedure closes the port when peek-char returns eof.

Additionally, you can use the utilities (e.g. extract-field) in "net/head.ss" to process the header.

Let me know of any bugs.