buf.readUInt8()

buf.readUInt8(offset[, noAssert])


  • offset {Number} 0 <= offset <= buf.length - 1

  • noAssert {Boolean} 默认:false

  • 返回:{Number}


从该 Buffer 指定的 offset 位置开始读取一个无符号的8位整数值。
设置 noAssert 为 true ,将跳过对 offset 的验证。这将允许 offset 超出缓冲区的末尾。

const buf = Buffer.from([1, -2, 3, 4]);

buf.readUInt8(0);
// returns 1
buf.readUInt8(1);
// returns 254

猜你喜欢

转载自www.cnblogs.com/lalalagq/p/9908664.html