Class: List

packet.List()

new List()

This class represents a list of openpgp packets. Take care when iterating over it - the packets themselves are stored as numerical indices.

Source:

Members

(readonly) length :Integer

The number of packets contained within the list.

Type:
  • Integer
Source:

Methods

(static) fromStructuredClone(packetClone) → {Object}

Allocate a new packetlist from structured packetlist clone See https://w3c.github.io/html/infrastructure.html#safe-passing-of-structured-data

Parameters:
Name Type Description
packetClone Object

packetlist clone

Source:
Returns:

new packetlist object with data from packetlist clone

Type
Object

concat()

Concatenates packetlist or array of packets

Source:

every()

Executes the callback function once for each element, returns true if all callbacks returns a truthy value

Source:

filter()

Creates a new PacketList with all packets that pass the test implemented by the provided function.

Source:

filterByTag()

Creates a new PacketList with all packets from the given types

Source:

findPacket(type) → {module:packet/packet|null}

Traverses packet tree and returns first matching packet

Parameters:
Name Type Description
type module:enums.packet

The packet type

Source:
Returns:
Type
module:packet/packet | null

forEach()

Executes the provided callback once for each element

Source:

indexOfTag()

Returns array of found indices by tag

Source:

map()

Returns an array containing return values of callback on each element

Source:

pop() → {Object}

Remove a packet from the list and return it.

Source:
Returns:

The packet that was removed

Type
Object

push(packet)

Adds a packet to the list. This is the only supported method of doing so; writing to packetlist[i] directly will result in an error.

Parameters:
Name Type Description
packet Object

Packet to push

Source:

read(A)

Reads a stream of binary data and interprents it as a list of packets.

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

Uint8Array of bytes.

Source:

slice()

Returns slice of packetlist

Source:

(async) some(callback) → {Promise.<Boolean>}

Executes the callback function once for each element until it finds one where callback returns a truthy value

Parameters:
Name Type Description
callback function
Source:
Returns:
Type
Promise.<Boolean>

write() → {Uint8Array}

Creates a binary representation of openpgp objects contained within the class instance.

Source:
Returns:

A Uint8Array containing valid openpgp packets.

Type
Uint8Array