From 222f98df74e54eec84fe486ca1721109ea3b3376 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sun, 13 Jan 2019 19:49:56 +0200 Subject: [PATCH] doc: fix sorting in buffer.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR places `Buffer.from(object...)` section before `Buffer.from(string...)` section and upper-cased bottom references before backtick-started ones. PR-URL: https://github.com/nodejs/node/pull/25477 Reviewed-By: Anna Henningsen Reviewed-By: Tobias Nießen Reviewed-By: Luigi Pinca Reviewed-By: Beth Griggs --- doc/api/buffer.md | 56 +++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 73405ea95412f9..ccde0702275375 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -862,31 +862,6 @@ console.log(buf2.toString()); A `TypeError` will be thrown if `buffer` is not a `Buffer`. -### Class Method: Buffer.from(string[, encoding]) - - -* `string` {string} A string to encode. -* `encoding` {string} The encoding of `string`. **Default:** `'utf8'`. - -Creates a new `Buffer` containing `string`. The `encoding` parameter identifies -the character encoding of `string`. - -```js -const buf1 = Buffer.from('this is a tést'); -const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); - -console.log(buf1.toString()); -// Prints: this is a tést -console.log(buf2.toString()); -// Prints: this is a tést -console.log(buf1.toString('ascii')); -// Prints: this is a tC)st -``` - -A `TypeError` will be thrown if `string` is not a string. - ### Class Method: Buffer.from(object[, offsetOrEncoding[, length]]) + +* `string` {string} A string to encode. +* `encoding` {string} The encoding of `string`. **Default:** `'utf8'`. + +Creates a new `Buffer` containing `string`. The `encoding` parameter identifies +the character encoding of `string`. + +```js +const buf1 = Buffer.from('this is a tést'); +const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); + +console.log(buf1.toString()); +// Prints: this is a tést +console.log(buf2.toString()); +// Prints: this is a tést +console.log(buf1.toString('ascii')); +// Prints: this is a tC)st +``` + +A `TypeError` will be thrown if `string` is not a string. + ### Class Method: Buffer.isBuffer(obj)