Class: Literal

packet.Literal(date)

new Literal(date)

Implementation of the Literal Data Packet (Tag 11)

RFC4880 5.9: A Literal Data packet contains the body of a message; data that is not to be further interpreted.

Parameters:
Name Type Description
date Date

the creation date of the literal package

Source:

Methods

getBytes() → {Uint8Array}

Get the byte sequence representing the literal packet data

Source:
Returns:

A sequence of bytes

Type
Uint8Array

getFilename() → {String}

Get the filename of the literal packet data

Source:
Returns:

filename

Type
String

getText() → {String}

Returns literal data packets as native JavaScript string with normalized end of line to \n

Source:
Returns:

literal data as text

Type
String

read(input) → {module:packet.Literal}

Parsing function for a literal data packet (tag 11).

Parameters:
Name Type Description
input Uint8Array

Payload of a tag 11 packet

Source:
Returns:

object representation

Type
module:packet.Literal

setBytes(bytes, format)

Set the packet data to value represented by the provided string of bytes.

Parameters:
Name Type Description
bytes Uint8Array

The string of bytes

format utf8 | binary | text | mime

The format of the string of bytes

Source:

setFilename(filename)

Sets the filename of the literal packet data

Parameters:
Name Type Description
filename String

Any native javascript string

Source:

setText(text, format)

Set the packet data to a javascript native string, end of line will be normalized to \r\n and by default text is converted to UTF8

Parameters:
Name Type Description
text String

Any native javascript string

format utf8 | binary | text | mime

(optional) The format of the string of bytes

Source:

write() → {Uint8Array}

Creates a string representation of the packet

Source:
Returns:

Uint8Array representation of the packet

Type
Uint8Array