diff options
author | Rich Trott <rtrott@gmail.com> | 2018-04-17 15:39:28 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-04-19 20:55:47 -0700 |
commit | 76f5b3966bc9bcc275728ce2317183272899272c (patch) | |
tree | 2421854f75f07921fdaebcec2aba025089035881 /doc/api/buffer.md | |
parent | 7007eee6a272398054c65f2f32bdf3467a29ee9f (diff) | |
download | android-node-v8-76f5b3966bc9bcc275728ce2317183272899272c.tar.gz android-node-v8-76f5b3966bc9bcc275728ce2317183272899272c.tar.bz2 android-node-v8-76f5b3966bc9bcc275728ce2317183272899272c.zip |
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 <vsemozhetbyt@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'doc/api/buffer.md')
-rw-r--r-- | doc/api/buffer.md | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 8bd82d6206..1a1cfebe5a 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); |