Skip to content

hashmail/imap-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Build Status

Installation

$ npm install imap-parser

API

To create an instance of the line parser:

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

The parser is a writable & readable stream. Just pipe the data stream from the TCP connection in and read the parsed lines out as data events. Each data event contains an array with the parsed data for a line. String literals are also handled more or less automatically (see caviat in events).

Events

log

Is emitted with a string as its data. This string is the entire unparsed content of the line. It is useful for logging:

parser.on('log', function (line) {
  console.log('c: ' + line)
})

literal

Is emitted when the client is sending a literal to the server but is waiting for a command continuation request:

parser.on('literal', function () {
  connection.write('+ Ready for additional command text')
})

Licence

MIT

About

IMAP parser for both client and server

Resources

License

Stars

Watchers

Forks

Packages

No packages published