summaryrefslogtreecommitdiff
path: root/doc/api/buffer.md
diff options
context:
space:
mode:
authorVse Mozhet Byt <vsemozhetbyt@gmail.com>2019-01-13 19:49:56 +0200
committerVse Mozhet Byt <vsemozhetbyt@gmail.com>2019-01-13 23:48:20 +0200
commit27dc74fdd0950d39d175145400a70174244870d9 (patch)
tree5d0a64ec195479b01761bd29b49f754c81db46e4 /doc/api/buffer.md
parent9e7d4cac3f13966e5e2a691d8d90ad659f1907c5 (diff)
downloadandroid-node-v8-27dc74fdd0950d39d175145400a70174244870d9.tar.gz
android-node-v8-27dc74fdd0950d39d175145400a70174244870d9.tar.bz2
android-node-v8-27dc74fdd0950d39d175145400a70174244870d9.zip
doc: fix sorting in buffer.md
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 <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Diffstat (limited to 'doc/api/buffer.md')
-rw-r--r--doc/api/buffer.md56
1 files changed, 28 insertions, 28 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md
index 4f28095a92..1bfd30b194 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])
-<!-- YAML
-added: v5.10.0
--->
-
-* `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]])
<!-- YAML
added: v8.2.0
@@ -921,6 +896,31 @@ const buf = Buffer.from(new Foo(), 'utf8');
// Prints: <Buffer 74 68 69 73 20 69 73 20 61 20 74 65 73 74>
```
+### Class Method: Buffer.from(string[, encoding])
+<!-- YAML
+added: v5.10.0
+-->
+
+* `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)
<!-- YAML
added: v0.1.101
@@ -2642,6 +2642,9 @@ in UTF-16 code units.
This value may depend on the JS engine that is being used.
+[RFC1345]: https://tools.ietf.org/html/rfc1345
+[RFC4648, Section 5]: https://tools.ietf.org/html/rfc4648#section-5
+[WHATWG Encoding Standard]: https://encoding.spec.whatwg.org/
[`ArrayBuffer#slice()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/slice
[`ArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
[`Buffer.alloc()`]: #buffer_class_method_buffer_alloc_size_fill_encoding
@@ -2678,7 +2681,4 @@ This value may depend on the JS engine that is being used.
[`buffer.constants.MAX_STRING_LENGTH`]: #buffer_buffer_constants_max_string_length
[`buffer.kMaxLength`]: #buffer_buffer_kmaxlength
[`util.inspect()`]: util.html#util_util_inspect_object_options
-[RFC1345]: https://tools.ietf.org/html/rfc1345
-[RFC4648, Section 5]: https://tools.ietf.org/html/rfc4648#section-5
-[WHATWG Encoding Standard]: https://encoding.spec.whatwg.org/
[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols