# Module: packet/packet

Functions for reading and writing packets

Source:
  - packet/packet.js, line 18

### Methods

#### (static) readPackets(input, callback) → {Boolean}

Generic static Packet Parser function

##### Parameters:

Name | Type | Description
--- | --- | ---
`input` | Uint8Array | ReadableStream.<Uint8Array> | Input stream as string
`callback` | function | Function to call with the parsed packet

Source:
  - packet/packet.js, line 117

##### Returns:

Returns false if the stream was empty and parsing is done, and true otherwise.

Type
  Boolean

#### (static) supportsStreaming(tag) → {Boolean}

Whether the packet type supports partial lengths per RFC4880

##### Parameters:

Name | Type | Description
--- | --- | ---
`tag` | Integer | Tag type

Source:
  - packet/packet.js, line 100

##### Returns:

String of the header.

Type
  Boolean

#### (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 90

##### Returns:

String of the header.

Type
  String

#### (static) writeSimpleLength(length) → {Uint8Array}

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 57

##### Returns:

String with openpgp length representation.

Type
  Uint8Array