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.
RFC4880 5.9: A Literal Data packet contains the body of a message; data that is not to be further interpreted.
new (require("packet/literal"))()
- Source:
- Source:
Requires
Methods
-
getBytes() → {String}
-
Get the byte sequence representing the literal packet data
- Source:
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:
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:
Returns:
object representation -
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:
-
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:
-
write(data) → {String}
-
Creates a string representation of the packet
Parameters:
Name Type Description data
String The data to be inserted as body - Source:
Returns:
string-representation of the packet- Type
- String