buf.writeUInt16BE()
buf.writeUInt16BE(value, offset[, noAssert])
buf.writeUInt16LE(value, offset[, noAssert])
- value {Number} 需要被写入到 Buffer 的字节
- offset {Number} 0 <= offset <= buf.length - 2
- noAssert {Boolean} 默认:false
- 返回:{Number} 偏移加上被写入的字节数
console.log(buf);
// Prints:
buf.writeUInt16LE(0xdead, 0);
buf.writeUInt16LE(0xbeef, 2);
console.log(buf);
// Prints: