imap-parser

A parser for IMAP line based commands

imap-parser

IMAP command parser for use on both client and server. This is based on work in andris9/inbox and provides a parser for IMAP line based commands.

$ npm install imap-parser

To create an instance of the line parser:

var Parser = require('imap-parser')
var parser = new Parser()

The parser is a writable stream with some extensions.

Write some data to be parsed.

If a literal occurs ({123}\r\n) do not parse it, since the length is known. Just add it separately and it will included as the node value instead of length property.

Mark the end of the data, optionally passing one last chunk of data to be parsed.

Generates and returns a structured object with the data currently known. Useful if you need to check parse status in the middle of the process

To register for these events, do:

parser.on('EventName', function (data) {
  
})

Is emitted with a string as its data. This string is the entire unparsed content of the line.

Is emitted with a structured array as its data. This array is the result of parsing the line.

MIT