# Module: packet/packet

## packet/packet

Source:
  - packet/packet.js, line 18

### Methods

#### <static> read(input, position, len) → {Object}

  Generic static Packet Parser function

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `input` | String | Input stream as string
  `position` | integer | Position to start parsing
  `len` | integer | Length of the input from position on

  Source:
    - packet/packet.js, line 120

  ##### Returns:

  Returns a parsed module:packet/packet
  Type
    Object

#### <static> writeHeader(tag_type, length) → {String}

  Writes a packet header version 4 with the given tag_type and length to a string

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `tag_type` | Integer | Tag type
  `length` | Integer | Length of the payload

  Source:
    - packet/packet.js, line 81

  ##### Returns:

  String of the header
  Type
    String

#### <static> writeOldHeader(tag_type, length) → {String}

  Writes a packet header Version 3 with the given tag_type and length to a string

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `tag_type` | Integer | Tag type
  `length` | Integer | Length of the payload

  Source:
    - packet/packet.js, line 97

  ##### Returns:

  String of the header
  Type
    String

#### <static> writeSimpleLength(length) → {String}

  Encodes a given integer of length to the openpgp length specifier to a string

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `length` | Integer | The length to encode

  Source:
    - packet/packet.js, line 55

  ##### Returns:

  String with openpgp length representation
  Type
    String