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

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

##### Returns:

A sequence of bytes.

Type
  Uint8Array | ReadableStream.<Uint8Array>

#### getFilename() → {String}

Get the filename of the literal packet data

Source:
  - packet/literal_data.js, line 112

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

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

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

#### setFilename(filename)

Sets the filename of the literal packet data

##### Parameters:

Name | Type | Description
--- | --- | ---
`filename` | String | Any native javascript string

Source:
  - packet/literal_data.js, line 103

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

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

Creates a Uint8Array representation of the packet

Source:
  - packet/literal_data.js, line 159

##### Returns:

Uint8Array representation of the packet.

Type
  Uint8Array | ReadableStream.<Uint8Array>

#### writeHeader() → {Uint8Array}

Creates a Uint8Array representation of the packet, excluding the data

Source:
  - packet/literal_data.js, line 144

##### Returns:

Uint8Array representation of the packet.

Type
  Uint8Array