buf.readUInt32BE()函数详解


buf.readUInt32BE(offset[, noAssert])
buf.readUInt32LE(offset[, noAssert])

  • offset {Number} 0 <= offset <= buf.length - 4
  • noAssert {Boolean} 默认:false
  • 返回:{Number}
从该 Buffer 指定的带有特定尾数格式(readUInt32BE() 返回一个较大的尾数,readUInt32LE() 返回一个较小的尾数)的 offset 位置开始读取一个无符号的32位整数值。 设置 noAssert 为 true ,将跳过对 offset 的验证。这将允许 offset 超出缓冲区的末尾。 例子: ``` const buf = Buffer.from([0x3, 0x4, 0x23, 0x42]);

buf.readUInt32BE(0);
// Returns: 0x03042342
console.log(buf.readUInt32LE(0));
// Returns: 0x42230403


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM