0.1.6 • Published 5 years ago
tk-pop3-client v0.1.6
POP3 Client
References:
Examples:
import { Client } from './tk-pop3-client'
const client = new Client({
host: 'xxx.xxx.xx.xx',
port: 9090,
username: 'username',
password: 'password',
tls: true,
timeout: 10000
})
client.STAT().then(result => {
///
})
client.QUIT().then(info => {
///
})API:
Client
interface IClientOptions {
username: string
password: string
host: string
port: number
tls?: boolean
timeout?: number
}static create(options: IClientOptions): Clientpublic UIDL(msgOrder?: string): Promise<string[] | string[][]>public NOOP(): Promise<void>public LIST(msgOrder?: string): Promise<string[] | string[][]>public RSET(): Promise<string>public RETR(msgOrder?: string): Promise<string>public DELE(msgOrder?: string): Promise<string>public STAT(): Promise<string>public TOP(msgOrder: string, n?: number): Promise<string>public QUIT(): Promise<string>Command
type CommandKeywords =
// Minimal POP3 Command Keywords:
| 'USER'
| 'PASS'
| 'QUIT'
| 'STAT'
| 'LIST'
| 'RETR'
| 'DELE'
| 'NOOP'
| 'RSET'
| 'QUIT'
// Optional POP3 Command Keywords:
| 'APOP'
| 'TOP'
| 'UIDL'
type CommandMessageContent =
| string
| Buffer
| { toString(): string }
static create(name: CommandKeywords, params?: string[], message?: CommandMessageContent): Commandstatic combine(...commands: Command[]): stringpublic toRaw(): stringpublic toString(): stringpublic update(params: string[], message: CommandMessageContent): thispublic updateParams(params: string[]): thispublic updateMessage(message: CommandMessageContent): thisConnection
interface IConnectionOptions {
host: string
port: number
tls?: boolean
timeout?: number
}get connected(): booleanstatic create(options: IConnectionOptions): Connectionpublic connect(): Promise<true>public send(payload: string | Command): Promise<[string, Readable]>public destroy(): Promise<true>