0.0.1 • Published 9 years ago

co-poplib v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

Promisify wrapper for poplib

Install

$ npm install co-poplib

Usage

var POP3Client = require('co-poplib');
var co = require('co');

co(function *() {
	var client = yield POP3Client(port, host, {
		ignoretlserrs: false,
		enabletls: true,
		debug: false
	});
	yield client.login(username, password);

	var list = yield client.list();

	if (list.length > 0) {
		var message = yield client.retr(1);
		yield client.dele(1);
	}
	yield client.quit();
})();

API

The API is the same as poplib's API.

If the success event emitted has a data argument, then data is returned, otherwise true is returned.

When one of the three error event emits, an Error will be thrown.

You can use client.raw.<API> to retrieve the rawdata argument of the success event instead of the data argument.