From 06e438c1083c0ce2bdc7ec1e605e7466a3e06e73 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sat, 26 Nov 2016 23:25:20 +0200 Subject: [PATCH] doc: fix examples in buffer.md to avoid confusion On some systems, some first bytes of allocated buffer can be zeroed by default, so the example doesn't work well - the buffer looks zeroed even before the fill. Fixes: https://github.com/nodejs/node/issues/9786 PR-URL: https://github.com/nodejs/node/pull/9795 Reviewed-By: Sam Roberts Reviewed-By: Roman Reiss Reviewed-By: Anna Henningsen --- doc/api/buffer.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 17b434ed9e39e4..cddb478226642c 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -1,4 +1,4 @@ -# Buffer +# Buffer > Stability: 2 - Stable @@ -404,14 +404,14 @@ are unknown and *could contain sensitive data*. Use Example: ```js -const buf = new Buffer(5); +const buf = new Buffer(10); -// Prints: (contents may vary): +// Prints: (contents may vary): console.log(buf); buf.fill(0); -// Prints: +// Prints: console.log(buf); ``` @@ -523,14 +523,14 @@ initialized*. The contents of the newly created `Buffer` are unknown and Example: ```js -const buf = Buffer.allocUnsafe(5); +const buf = Buffer.allocUnsafe(10); -// Prints: (contents may vary): +// Prints: (contents may vary): console.log(buf); buf.fill(0); -// Prints: +// Prints: console.log(buf); ```