Documentation ¶
Index ¶
- func NewBuffer(call goja.ConstructorCall, runtime *goja.Runtime) *goja.Object
- type Buffer
- func (b *Buffer) Bytes() []byte
- func (b *Buffer) Hex() string
- func (b *Buffer) Hexdump() string
- func (b *Buffer) Len() int
- func (b *Buffer) Pack(formatStr string, msg any) error
- func (b *Buffer) String() string
- func (b *Buffer) Write(data []byte) *Buffer
- func (b *Buffer) WriteString(data string) *Buffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a bytes/Uint8Array type in javascript @example ```javascript const bytes = require('nuclei/bytes'); const bytes = new bytes.Buffer(); ``` @example ```javascript const bytes = require('nuclei/bytes'); // optionally it can accept existing byte/Uint8Array as input const bytes = new bytes.Buffer([1, 2, 3]); ```
func (*Buffer) Bytes ¶
Bytes returns the byte representation of the buffer. @example ```javascript const bytes = require('nuclei/bytes'); const buffer = new bytes.Buffer(); buffer.WriteString('hello'); log(buffer.Bytes()); ```
func (*Buffer) Hex ¶
Hex returns the hex representation of the buffer. @example ```javascript const bytes = require('nuclei/bytes'); const buffer = new bytes.Buffer(); buffer.WriteString('hello'); log(buffer.Hex()); ```
func (*Buffer) Hexdump ¶
Hexdump returns the hexdump representation of the buffer. @example ```javascript const bytes = require('nuclei/bytes'); const buffer = new bytes.Buffer(); buffer.WriteString('hello'); log(buffer.Hexdump()); ```
func (*Buffer) Len ¶
Len returns the length of the buffer. @example ```javascript const bytes = require('nuclei/bytes'); const buffer = new bytes.Buffer(); buffer.WriteString('hello'); log(buffer.Len()); ```
func (*Buffer) Pack ¶
Pack uses structs.Pack and packs given data and appends it to the buffer. it packs the data according to the given format. @example ```javascript const bytes = require('nuclei/bytes'); const buffer = new bytes.Buffer(); buffer.Pack('I', 123); ```
func (*Buffer) String ¶
String returns the string representation of the buffer. @example ```javascript const bytes = require('nuclei/bytes'); const buffer = new bytes.Buffer(); buffer.WriteString('hello'); log(buffer.String()); ```
func (*Buffer) Write ¶
Write appends the given data to the buffer. @example ```javascript const bytes = require('nuclei/bytes'); const buffer = new bytes.Buffer(); buffer.Write([1, 2, 3]); ```
func (*Buffer) WriteString ¶
WriteString appends the given string data to the buffer. @example ```javascript const bytes = require('nuclei/bytes'); const buffer = new bytes.Buffer(); buffer.WriteString('hello'); ```