Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7cbb4b0
tools,doc: enable changelogs for items
addaleax Jan 10, 2017
a0af305
doc: add changelogs for assert
addaleax Feb 21, 2017
7b6e302
doc: add changelogs for buffer
addaleax Feb 21, 2017
d6a3cfa
doc: add changelogs for child_process
addaleax Feb 21, 2017
7f24ec1
doc: add changelogs for cli
addaleax Feb 21, 2017
dc10c1a
doc: add changelogs for cluster
addaleax Feb 21, 2017
7b5a4ba
doc: add changelogs for console
addaleax Feb 21, 2017
d27c983
doc: add changelogs for crypto
addaleax Feb 21, 2017
fb9572b
doc: add changelogs for dgram
addaleax Feb 21, 2017
049a636
doc: add changelogs for dns
addaleax Feb 21, 2017
8fb16fd
doc: add changelogs for events
addaleax Feb 21, 2017
d2e4742
doc: add changelogs for fs
addaleax Feb 21, 2017
cfa06fa
doc: add changelogs for http
addaleax Feb 21, 2017
c3132ed
doc: add changelogs for net
addaleax Feb 21, 2017
ebb2d99
doc: add changelogs for os
addaleax Feb 21, 2017
fb39597
doc: add changelogs for path
addaleax Feb 21, 2017
3f3d62a
doc: add changelogs for process
addaleax Feb 21, 2017
c5a4edb
doc: add changelogs for punycode
addaleax Feb 21, 2017
e9680c5
doc: add changelogs for querystring
addaleax Feb 21, 2017
d9c3a27
doc: add changelogs for readline
addaleax Feb 21, 2017
3115904
doc: add changelogs for repl
addaleax Feb 21, 2017
a70aa58
doc: add changelogs for stream
addaleax Feb 21, 2017
0dc6ff7
doc: add changelogs for tls
addaleax Feb 21, 2017
c9bfa9c
doc: add changelogs for url
addaleax Feb 21, 2017
2426aaf
doc: add changelogs for util
addaleax Feb 21, 2017
5d46266
doc: add changelogs for v8
addaleax Feb 21, 2017
08d5ab9
doc: add changelogs for vm
addaleax Feb 21, 2017
adcd0bd
doc: add changelogs for zlib
addaleax Feb 21, 2017
5da9524
doc: document pending semver-major API changes
addaleax Feb 21, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
doc: add changelogs for buffer
PR-URL: #11489
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
  • Loading branch information
addaleax committed Feb 24, 2017
commit 7b6e30215d8155617c177bdc3f99e0b3b41d8540
88 changes: 88 additions & 0 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ extra care *must* be taken in order to avoid introducing security
vulnerabilities into an application.

## Buffers and Character Encodings
<!-- YAML
changes:
- version: v6.4.0
pr-url: https://github.com/nodejs/node/pull/7111
description: Introduced `latin1` as an alias for `binary`.
- version: v5.0.0
pr-url: https://github.com/nodejs/node/pull/2859
description: Removed the deprecated `raw` and `raws` encodings.
-->

`Buffer` instances are commonly used to represent sequences of encoded characters
such as UTF-8, UCS2, Base64 or even Hex-encoded data. It is possible to
Expand Down Expand Up @@ -188,6 +197,12 @@ that the server actually returned win-1252-encoded data, and using `'latin1'`
encoding may incorrectly decode the characters.

## Buffers and TypedArray
<!-- YAML
changes:
- version: v3.0.0
pr-url: https://github.com/nodejs/node/pull/2002
description: The `Buffer`s class now inherits from `Uint8Array`.
-->

`Buffer` instances are also [`Uint8Array`] instances. However, there are subtle
incompatibilities with the TypedArray specification in ECMAScript 2015.
Expand Down Expand Up @@ -298,6 +313,13 @@ It can be constructed in a variety of ways.
### new Buffer(array)
<!-- YAML
deprecated: v6.0.0
changes:
- version: v7.2.1
pr-url: https://github.com/nodejs/node/pull/9529
description: Calling this constructor no longer emits a deprecation warning.
- version: v7.0.0
pr-url: https://github.com/nodejs/node/pull/8169
description: Calling this constructor emits a deprecation warning now.
-->

> Stability: 0 - Deprecated: Use [`Buffer.from(array)`] instead.
Expand All @@ -315,7 +337,18 @@ const buf = new Buffer([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);

### new Buffer(arrayBuffer[, byteOffset [, length]])
<!-- YAML
added: v3.0.0
deprecated: v6.0.0
changes:
- version: v7.2.1
pr-url: https://github.com/nodejs/node/pull/9529
description: Calling this constructor no longer emits a deprecation warning.
- version: v7.0.0
pr-url: https://github.com/nodejs/node/pull/8169
description: Calling this constructor emits a deprecation warning now.
- version: v6.0.0
pr-url: https://github.com/nodejs/node/pull/4682
description: The `byteOffset` and `length` parameters are supported now.
-->

> Stability: 0 - Deprecated: Use
Expand Down Expand Up @@ -360,6 +393,13 @@ console.log(buf);
### new Buffer(buffer)
<!-- YAML
deprecated: v6.0.0
changes:
- version: v7.2.1
pr-url: https://github.com/nodejs/node/pull/9529
description: Calling this constructor no longer emits a deprecation warning.
- version: v7.0.0
pr-url: https://github.com/nodejs/node/pull/8169
description: Calling this constructor emits a deprecation warning now.
-->

> Stability: 0 - Deprecated: Use [`Buffer.from(buffer)`] instead.
Expand All @@ -386,6 +426,13 @@ console.log(buf2.toString());
### new Buffer(size)
<!-- YAML
deprecated: v6.0.0
changes:
- version: v7.2.1
pr-url: https://github.com/nodejs/node/pull/9529
description: Calling this constructor no longer emits a deprecation warning.
- version: v7.0.0
pr-url: https://github.com/nodejs/node/pull/8169
description: Calling this constructor emits a deprecation warning now.
-->

> Stability: 0 - Deprecated: Use [`Buffer.alloc()`] instead (also see
Expand Down Expand Up @@ -419,6 +466,13 @@ console.log(buf);
### new Buffer(string[, encoding])
<!-- YAML
deprecated: v6.0.0
changes:
- version: v7.2.1
pr-url: https://github.com/nodejs/node/pull/9529
description: Calling this constructor no longer emits a deprecation warning.
- version: v7.0.0
pr-url: https://github.com/nodejs/node/pull/8169
description: Calling this constructor emits a deprecation warning now.
-->

> Stability: 0 - Deprecated:
Expand Down Expand Up @@ -508,6 +562,10 @@ A `TypeError` will be thrown if `size` is not a number.
### Class Method: Buffer.allocUnsafe(size)
<!-- YAML
added: v5.10.0
changes:
- version: v7.0.0
pr-url: https://github.com/nodejs/node/pull/7079
description: Passing a negative `size` will now throw an error.
-->

* `size` {Integer} The desired length of the new `Buffer`
Expand Down Expand Up @@ -606,6 +664,14 @@ A `TypeError` will be thrown if `size` is not a number.
### Class Method: Buffer.byteLength(string[, encoding])
<!-- YAML
added: v0.1.90
changes:
- version: v7.0.0
pr-url: https://github.com/nodejs/node/pull/8946
description: Passing invalid input will now throw an error.
- version: v5.10.0
pr-url: https://github.com/nodejs/node/pull/5255
description: The `string` parameter can now be any `TypedArray`, `DataView`
or `ArrayBuffer`.
-->

* `string` {String | Buffer | TypedArray | DataView | ArrayBuffer} A value to
Expand Down Expand Up @@ -899,6 +965,10 @@ console.log(buffer.buffer === arrayBuffer);
### buf.compare(target[, targetStart[, targetEnd[, sourceStart[, sourceEnd]]]])
<!-- YAML
added: v0.11.13
changes:
- version: v5.11.0
pr-url: https://github.com/nodejs/node/pull/5880
description: Additional parameters for specifying offsets are supported now.
-->

* `target` {Buffer|Uint8Array} A `Buffer` or [`Uint8Array`] to compare to
Expand Down Expand Up @@ -1079,6 +1149,10 @@ console.log(buf1.equals(buf3));
### buf.fill(value[, offset[, end]][, encoding])
<!-- YAML
added: v0.5.0
changes:
- version: v5.7.0
pr-url: https://github.com/nodejs/node/pull/4935
description: The `encoding` parameter is supported now.
-->

* `value` {String | Buffer | Integer} The value to fill `buf` with
Expand Down Expand Up @@ -1157,6 +1231,11 @@ console.log(buf.includes('this', 4));
### buf.indexOf(value[, byteOffset][, encoding])
<!-- YAML
added: v1.5.0
changes:
- version: v5.7.0, v4.4.0
pr-url: https://github.com/nodejs/node/pull/4803
description: When `encoding` is being passed, the `byteOffset` parameter
is no longer required.
-->

* `value` {String | Buffer | Uint8Array | Integer} What to search for
Expand Down Expand Up @@ -1729,6 +1808,15 @@ console.log(buf.readUIntBE(1, 6).toString(16));
### buf.slice([start[, end]])
<!-- YAML
added: v0.3.0
changes:
- version: v7.1.0, v6.9.2
pr-url: https://github.com/nodejs/node/pull/9341
description: Coercing the offsets to integers now handles values outside
the 32-bit integer range properly.
- version: v7.0.0
pr-url: https://github.com/nodejs/node/pull/9101
description: All offsets are now coerced to integers before doing any
calculations with them.
-->

* `start` {Integer} Where the new `Buffer` will start. **Default:** `0`
Expand Down