doc: use Buffer.from() instead of new Buffer()

Use new API of Buffer to developers in most documents.

PR-URL: https://github.com/nodejs/node/pull/6367
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
This commit is contained in:
Jackson Tian authored and Jeremiah Senkpiel committed 2016-05-03 20:20:31 -04:00
1 parent cbbe95e1e1
commit 19fb1345ba
7 files changed
+13 -13

No files matched your search

+2 -2
View File
@@ -10,10 +10,10 @@ additional support for utf8.
const StringDecoder = require('string_decoder').StringDecoder;
const decoder = new StringDecoder('utf8');
const cent = new Buffer([0xC2, 0xA2]);
const cent = Buffer.from([0xC2, 0xA2]);
console.log(decoder.write(cent));
const euro = new Buffer([0xE2, 0x82, 0xAC]);
const euro = Buffer.from([0xE2, 0x82, 0xAC]);
console.log(decoder.write(euro));
```