# Module: packet/literal

## packet/literal

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

  Source:
    - packet/literal.js, line 30

Source:
  - packet/literal.js, line 18

### Methods

#### getBytes() → {String}

  Get the byte sequence representing the literal packet data
  Source:
    - packet/literal.js, line 75

  ##### Returns:

  A sequence of bytes
  Type
    String

#### getText() → {String}

  Returns literal data packets as native JavaScript string with normalized end of line to \n
  Source:
    - packet/literal.js, line 53

  ##### Returns:

  literal data as text
  Type
    String

#### read(input, position, len) → {module:packet/literal}

  Parsing function for a literal data packet (tag 11).

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `input` | String | Payload of a tag 11 packet
  `position` | Integer | Position to start reading from the input string
  `len` | Integer | Length of the packet or the remaining length of input at position

  Source:
    - packet/literal.js, line 91

  ##### Returns:

  object representation
  Type
    module:packet/literal

#### setBytes(bytes, format)

  Set the packet data to value represented by the provided string of bytes.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `bytes` | String | The string of bytes
  `format` | utf8 | binary | text | The format of the string of bytes

  Source:
    - packet/literal.js, line 65

#### setText(text)

  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 | Description
  --- | --- | ---
  `text` | String | Any native javascript string

  Source:
    - packet/literal.js, line 41

#### write(data) → {String}

  Creates a string representation of the packet

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `data` | String | The data to be inserted as body

  Source:
    - packet/literal.js, line 112

  ##### Returns:

  string-representation of the packet
  Type
    String