What is a buffer in Node.js?

后端 未结 3 1070
离开以前
离开以前 2021-02-02 06:34

As you can read in the Node.js documentation on the Buffer class, a buffer

is similar to an array of integers but corresponds to a raw memory allocation o

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 07:20

    Explanation from http://nodejitsu.com/...

    Buffers are instances of the Buffer class in node, which is designed to handle raw binary data. Each buffer corresponds to some raw memory allocated outside V8. Buffers act somewhat like arrays of integers, but aren't resizable and have a whole bunch of methods specifically for binary data. In addition, the "integers" in a buffer each represent a byte and so are limited to values from 0 to 255 (2^8 - 1), inclusive.

    Read more: Buffers in Node.js

提交回复
热议问题