We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7716828 commit bb867c0Copy full SHA for bb867c0
doc/api/buffer.markdown
@@ -40,6 +40,23 @@ encoding method. Here are the different string encodings.
40
41
* `'hex'` - Encode each byte as two hexadecimal characters.
42
43
+`Buffer` can also be used with Typed Array Views and DataViews.
44
+
45
+ var buff = new Buffer(4);
46
+ var ui16 = new Uint16Array(buff);
47
+ var view = new DataView(buff);
48
49
+ ui16[0] = 1;
50
+ ui16[1] = 2;
51
+ console.log(buff);
52
53
+ view.setInt16(0, 1); // set big-endian int16 at byte offset 0
54
+ view.setInt16(2, 2, true); // set little-endian int16 at byte offset 2
55
56
57
+ // <Buffer 01 00 02 00>
58
+ // <Buffer 00 01 02 00>
59
60
## Class: Buffer
61
62
The Buffer class is a global type for dealing with binary data directly.
0 commit comments