buf.writeFloatBE(value, offset[, noAssert])

buf.writeFloatLE(value, offset[, noAssert])

  • value {Number} 需要被写入到 Buffer 的字节
  • offset {Number} 0
  • noAssert {Boolean} 默认:false
  • 返回:{Number} 偏移加上被写入的字节数

从该 Buffer 指定的带有特定尾数格式(writeFloatBE() 写入一个较大的尾数,writeFloatLE() 写入一个较小的尾数)的 offset 位置开始写入 value 。当值不是一个32位浮点值时,它的行为是不确定的。
将 noAssert 设为 true 将跳过对 value 和 offset 的验证。这意味着 value 可能对于这个特定的函数来说过大,并且 offset 可能超出该 Buffer 的末端,导致该值被直接丢弃。除非确定你的内容的正确性否则不应该被使用。
例子:
```
const buf = Buffer.allocUnsafe(4);
buf.writeFloatBE(0xcafebabe, 0);

console.log(buf);

// Prints: <Buffer 4f 4a fe bb>

buf.writeFloatLE(0xcafebabe, 0);

console.log(buf);

// Prints: <Buffer bb fe 4a 4f>

buf.writeFloatBE()函数详解的更多相关文章

  1. buf.writeUInt8()函数详解

    buf.writeUInt8(value, offset[, noAssert]) value {Number} 需要被写入到 Buffer 的字节 offset {Number} 0 <= o ...

  2. buf.writeUIntBE()函数详解

    buf.writeUIntBE(value, offset, byteLength[, noAssert]) buf.writeUIntLE(value, offset, byteLength[, n ...

  3. buf.writeInt32BE()函数详解

    buf.writeInt32BE(value, offset[, noAssert]) buf.writeInt32LE(value, offset[, noAssert]) value {Numbe ...

  4. buf.writeInt16BE()函数详解

    buf.writeInt16BE(value, offset[, noAssert]) buf.writeInt16LE(value, offset[, noAssert]) value {Numbe ...

  5. buf.writeInt8()函数详解

    buf.writeInt8(value, offset[, noAssert]) value {Number} 需要被写入到 Buffer 的字节 offset {Number} 0 <= of ...

  6. buf.writeDoubleBE()函数详解

    buf.writeDoubleBE(value, offset[, noAssert]) buf.writeDoubleLE(value, offset[, noAssert]) value {Num ...

  7. buf.writeIntBE()函数详解

    buf.writeIntBE(value, offset, byteLength[, noAssert]) buf.writeIntLE(value, offset, byteLength[, noA ...

  8. buf.readUInt32BE()函数详解

    buf.readUInt32BE(offset[, noAssert]) buf.readUInt32LE(offset[, noAssert]) offset {Number} 0 noAssert ...

  9. buf.readInt32LE函数详解

    offset {Number} 0 noAssert {Boolean} 默认:false 返回:{Number} 从该 Buffer 指定的带有特定尾数格式(readInt32BE() 返回一个较大 ...

随机推荐

  1. 深入理解JMM(Java内存模型) --(四)volatile

    volatile的特性 当我们声明共享变量为volatile后,对这个变量的读/写将会很特别.理解volatile特性的一个好方法是:把对volatile变量的单个读/写,看成是使用同一个监视器锁对这 ...

  2. 搜索goog

    http://www.tech365.net/share/24.html 64.233.160.132|64.233.168.17|64.233.168.167|64.233.160.98|64.23 ...

  3. E20170602-ts

    questionnaire  n. 调查问卷; 调查表;  アンケート不是英语 collection   n. 征收; 收集,采集; 收藏品; 募捐; association   n. 联想; 协会, ...

  4. render same axis

    // 当前渲染相机的参数    QGlobalCamera* curRenderCamera = _getWorld()->getMainCam();    const Matrix4& ...

  5. url中传参数为中文的转码与解码解决方法

    1.转码 中文为 “你好”  var ProjectName = encodeURI(encodeURI("你好"));,如下图所示 跳转页面  window.location.h ...

  6. linux rpm 安装

    1.rpm 安装rpm -ivh package_name-i:install的意思-v:查看更详细的安装信息-h:以安装信息栏显示安装进度rpm -ivh package_name --test 2 ...

  7. ACM_Appleman and Card Game(简单贪心)

    Appleman and Card Game Time Limit: 2000/1000ms (Java/Others) Problem Description: Appleman has n car ...

  8. magento后台开发学习笔记(入门实例向)

    目的是做一个grid,参考博客http://www.sunzhenghua.com/magento-admin-module-development-part1-grid-forms-tabs-con ...

  9. docker血一样的教训,生成容器的时候一定要设置数据卷,把数据文件目录,配置文件目录,日志文件目录都要映射到宿主机上保存啊!!!

    打个比方,比如mysql,如果你想重新设置一下mysql的配置,不小心配错里,启动容器失败,已启动就停止了. 根本进不去mysql的容器里.如果之前run容器的时候,没有把数据文件,日志文件,配置文件 ...

  10. 页面置换算法-LRU(Least Recently Used)c++实现

    最近最久未使用(LRU)置换算法 #include <iostream> #include <cstdio> #include <cstring> #include ...