From 6d3c2d6212ebcce8d1a5e89c5e2dd5bae7fdec9b 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 bdf03263cccc13..d1b86d334b1f9c 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); ```