@@ -38,11 +38,11 @@ const buf3 = Buffer.allocUnsafe(10);
38
38
// Creates a Buffer containing [0x1, 0x2, 0x3].
39
39
const buf4 = Buffer .from ([1 , 2 , 3 ]);
40
40
41
- // Creates a Buffer containing ASCII bytes [0x74, 0x65, 0x73, 0x74].
42
- const buf5 = Buffer .from (' test' );
43
-
44
41
// Creates a Buffer containing UTF-8 bytes [0x74, 0xc3, 0xa9, 0x73, 0x74].
45
- const buf6 = Buffer .from (' tést' , ' utf8' );
42
+ const buf5 = Buffer .from (' tést' );
43
+
44
+ // Creates a Buffer containing Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
45
+ const buf6 = Buffer .from (' tést' , ' latin-1' );
46
46
```
47
47
48
48
## ` Buffer.from() ` , ` Buffer.alloc() ` , and ` Buffer.allocUnsafe() `
@@ -309,7 +309,7 @@ Allocates a new `Buffer` using an `array` of octets.
309
309
Example:
310
310
311
311
``` js
312
- // Creates a new Buffer containing the ASCII bytes of the string 'buffer'
312
+ // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'
313
313
const buf = new Buffer ([0x62 , 0x75 , 0x66 , 0x66 , 0x65 , 0x72 ]);
314
314
```
315
315
@@ -716,7 +716,7 @@ Allocates a new `Buffer` using an `array` of octets.
716
716
Example:
717
717
718
718
``` js
719
- // Creates a new Buffer containing ASCII bytes of the string 'buffer'
719
+ // Creates a new Buffer containing UTF-8 bytes of the string 'buffer'
720
720
const buf = Buffer .from ([0x62 , 0x75 , 0x66 , 0x66 , 0x65 , 0x72 ]);
721
721
```
722
722
0 commit comments