# Module: packet/packetlist

## packet/packetlist

#### new require("packet/packetlist")()

  Source:
    - packet/packetlist.js, line 13

Source:
  - packet/packetlist.js, line 1

### Members

#### <readonly> length :Integer

  The number of packets contained within the list.

  ##### Type:

  - Integer
  Source:
    - packet/packetlist.js, line 17

### Methods

#### concat()

  Concatenates packetlist or array of packets
  Source:
    - packet/packetlist.js, line 164

#### filter()

  Creates a new packetList with all packets that pass the test implemented by the provided function.
  Source:
    - packet/packetlist.js, line 72

#### filterByTag()

  Creates a new packetList with all packets from the given types
  Source:
    - packet/packetlist.js, line 88

#### 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:
    - packet/packetlist.js, line 116

  ##### Returns:

  Type
    module:packet/packet | null

#### forEach()

  Executes the provided callback once for each element
  Source:
    - packet/packetlist.js, line 105

#### indexOfTag()

  Returns array of found indices by tag
  Source:
    - packet/packetlist.js, line 135

#### push()

  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.
  Source:
    - packet/packetlist.js, line 60

#### read(An)

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

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `An` | openpgp_byte_array | array of bytes.

  Source:
    - packet/packetlist.js, line 23

#### slice()

  Returns slice of packetlist
  Source:
    - packet/packetlist.js, line 150

#### write() → {openpgp_byte_array}

  Creates a binary representation of openpgp objects contained within the class instance.
  Source:
    - packet/packetlist.js, line 44

  ##### Returns:

  An array of bytes containing valid openpgp packets.
  Type
    openpgp_byte_array