Class: Buffer
bytes.Buffer Buffer is a bytes/Uint8Array type in javascriptExample
Example
Table of contents
Constructors
Methods
Constructors
constructor
• new Buffer():Buffer
Returns
Buffer
Defined in
bytes.ts:21Methods
Bytes
▸ Bytes():Uint8Array
Bytes returns the byte representation of the buffer.
Returns
Uint8Array
Example
Defined in
bytes.ts:60Hex
▸ Hex():string
Hex returns the hex representation of the buffer.
Returns
string
Example
Defined in
bytes.ts:105Hexdump
▸ Hexdump():string
Hexdump returns the hexdump representation of the buffer.
Returns
string
Example
Defined in
bytes.ts:120Len
▸ Len():number
Len returns the length of the buffer.
Returns
number
Example
Defined in
bytes.ts:90Pack
▸ Pack(formatStr
, msg
): void
Pack uses structs.Pack and packs given data and appends it to the buffer.
it packs the data according to the given format.
Parameters
Name | Type |
---|---|
formatStr | string |
msg | any |
Returns
void
Example
Defined in
bytes.ts:135String
▸ String():string
String returns the string representation of the buffer.
Returns
string
Example
Defined in
bytes.ts:75Write
▸ Write(data
): Buffer
Write appends the given data to the buffer.
Parameters
Name | Type |
---|---|
data | Uint8Array |
Returns
Buffer
Example
Defined in
bytes.ts:31WriteString
▸ WriteString(data
): Buffer
WriteString appends the given string data to the buffer.
Parameters
Name | Type |
---|---|
data | string |
Returns
Buffer
Example