From 76f5b3966bc9bcc275728ce2317183272899272c Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 17 Apr 2018 15:39:28 -0700 Subject: [PATCH] doc: improve buf.write() text in buffer.md * Use present tense consistently in parameters description. * Wrap at 80 characters. * "partial amount of `string`" -> "part of `string`" * Unnecessary `Buffer.allocUnsafe()` changed to `Buffer.alloc()`. PR-URL: https://github.com/nodejs/node/pull/20115 Reviewed-By: Vse Mozhet Byt Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- doc/api/buffer.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 8bd82d6206ad40..1a1cfebe5ab0e7 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -2074,19 +2074,21 @@ for (const value of buf) { added: v0.1.90 --> -* `string` {string} String to be written to `buf`. -* `offset` {integer} Number of bytes to skip before starting to write `string`. **Default:** `0`. -* `length` {integer} Number of bytes to write. **Default:** `buf.length - offset`. +* `string` {string} String to write to `buf`. +* `offset` {integer} Number of bytes to skip before starting to write `string`. + **Default:** `0`. +* `length` {integer} Number of bytes to write. **Default:** + `buf.length - offset`. * `encoding` {string} The character encoding of `string`. **Default:** `'utf8'`. * Returns: {integer} Number of bytes written. -Writes `string` to `buf` at `offset` according to the character encoding in `encoding`. -The `length` parameter is the number of bytes to write. If `buf` did not contain -enough space to fit the entire string, only a partial amount of `string` will -be written. However, partially encoded characters will not be written. +Writes `string` to `buf` at `offset` according to the character encoding in +`encoding`. The `length` parameter is the number of bytes to write. If `buf` did +not contain enough space to fit the entire string, only part of `string` will be +written. However, partially encoded characters will not be written. ```js -const buf = Buffer.allocUnsafe(256); +const buf = Buffer.alloc(256); const len = buf.write('\u00bd + \u00bc = \u00be', 0);