buf.writeUInt8(value, offset[, noAssert])
Writes value
to the Buffer at the specified offset
. The value
should be a valid unsigned 8-bit integer. Behavior is not defined when value
is anything other than an unsigned 8-bit integer.
Set noAssert
to true to skip validation of value
and offset
. This means that value
may be too large for the specific function and offset
may be beyond the end of the Buffer leading to the values being silently dropped. This should not be used unless you are certain of correctness.
Example:
const buf = Buffer.allocUnsafe(4); buf.writeUInt8(0x3, 0); buf.writeUInt8(0x4, 1); buf.writeUInt8(0x23, 2); buf.writeUInt8(0x42, 3); console.log(buf); // Prints: <Buffer 03 04 23 42>
Please login to continue.