Neutral, Plus or Minus

    tk-pop3-client

    0.1.6 • Public • Published

    POP3 Client

    References:

    POP3 RFC

    Github node-pop3

    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): Client
    public 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): Command
    static combine(...commands: Command[]): string
    public toRaw(): string
    public toString(): string
    public update(params: string[], message: CommandMessageContent): this
    public updateParams(params: string[]): this
    public updateMessage(message: CommandMessageContent): this

    Connection

    interface IConnectionOptions {
        host: string
        port: number
        tls?: boolean
        timeout?: number
    }
    get connected(): boolean
    static create(options: IConnectionOptions): Connection
    public connect(): Promise<true>
    public send(payload: string | Command): Promise<[string, Readable]>
    public destroy(): Promise<true>

    Keywords

    Install

    npm i tk-pop3-client

    DownloadsWeekly Downloads

    0

    Version

    0.1.6

    License

    MIT

    Unpacked Size

    188 kB

    Total Files

    68

    Last publish

    Collaborators

    • chenjk110