Skip to main content

bytes

(bytes).Buffer

Buffer is a minimal buffer implementation to store and retrieve data Kind: inner class of bytes

buffer.Bytes() ⇒ Uint8Array

Bytes returns the byte slice of the buffer. Kind: instance method of Buffer
Returns: Uint8Array - - The byte slice of the buffer.
Example

buffer.Hex() ⇒ string

Hex returns the hex representation of the buffer. Kind: instance method of Buffer
Returns: string - - The hex representation of the buffer.
Example

buffer.Hexdump() ⇒ string

Hexdump returns the hexdump representation of the buffer. Kind: instance method of Buffer
Returns: string - - The hexdump representation of the buffer.
Example

buffer.Len() ⇒ number

Len returns the length of the buffer. Kind: instance method of Buffer
Returns: number - - The length of the buffer.
Example

buffer.Pack(formatStr, msg) ⇒ Buffer

Pack uses structs.Pack and packs given data and appends it to the buffer. It packs the data according to the given format. Kind: instance method of Buffer
Returns: Buffer - - The buffer after packing the data.
Throws:
  • error - The error encountered during packing.
Example

buffer.String() ⇒ string

String returns the string representation of the buffer. Kind: instance method of Buffer
Returns: string - - The string representation of the buffer.
Example

buffer.Write(data) ⇒ Buffer

Write appends a byte slice to the buffer. Kind: instance method of Buffer
Returns: Buffer - - The buffer after appending the byte slice.
Example

buffer.WriteString(data) ⇒ Buffer

WriteString appends a string to the buffer. Kind: instance method of Buffer
Returns: Buffer - - The buffer after appending the string.
Example

(bytes).NewBuffer(call) ⇒ Buffer

NewBuffer creates a new buffer from a byte slice. Kind: inner method of bytes
Returns: Buffer - - The new buffer created from the byte slice.
Example