Skip to main content

$bufferAlloc

Creates a new Buffer instance with the specified size, fill, and encoding, and sets it to a variable.

Parameters

ParameterDescription
nameThe name of the variable to set the buffer
sizeThe size of the buffer in bytes
fillOptional. The value used to fill the buffer. Default is 0.
encodingOptional. The encoding of the buffer. Default is "utf8".

Example

<AoiClient>.addCommand({
name: "create-buffer",
code: `
$bufferAlloc[myBuffer; 10; 1]
`,
});