Class: LiteralDataPacket

LiteralDataPacket(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.

Constructor

new LiteralDataPacket(date)

Parameters:
Name Type Description
date Date

The creation date of the literal package

Source:

Methods

getBytes(cloneopt) → {Uint8Array|ReadableStream.<Uint8Array>}

Get the byte sequence representing the literal packet data

Parameters:
Name Type Attributes Default Description
clone Boolean <optional>
false

Whether to return a clone so that getBytes/getText can be called again

Source:
Returns:

A sequence of bytes.

Type
Uint8Array | ReadableStream.<Uint8Array>

getFilename() → {String}

Get the filename of the literal packet data

Source:
Returns:

Filename.

Type
String

getText(cloneopt) → {String|ReadableStream.<String>}

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

Parameters:
Name Type Attributes Default Description
clone Boolean <optional>
false

Whether to return a clone so that getBytes/getText can be called again

Source:
Returns:

Literal data as text.

Type
String | ReadableStream.<String>

(async) read(input) → {Promise.<LiteralDataPacket>}

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

Parameters:
Name Type Description
input Uint8Array | ReadableStream.<Uint8Array>

Payload of a tag 11 packet

Source:
Returns:

Object representation.

Type
Promise.<LiteralDataPacket>

setBytes(bytes, format)

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

Parameters:
Name Type Description
bytes Uint8Array | ReadableStream.<Uint8Array>

The string of bytes

format enums.literal

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, formatopt)

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 Attributes Description
text String | ReadableStream.<String>

Any native javascript string

format enums.literal <optional>

The format of the string of bytes

Source:

write() → {Uint8Array|ReadableStream.<Uint8Array>}

Creates a Uint8Array representation of the packet

Source:
Returns:

Uint8Array representation of the packet.

Type
Uint8Array | ReadableStream.<Uint8Array>

writeHeader() → {Uint8Array}

Creates a Uint8Array representation of the packet, excluding the data

Source:
Returns:

Uint8Array representation of the packet.

Type
Uint8Array