Skip to content

Commit

Permalink
doc: add changelogs for buffer
Browse files Browse the repository at this point in the history
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 25, 2017
1 parent 5979451 commit b1b6b8b
Showing 1 changed file with 88 additions and 0 deletions.
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 @@ -886,6 +952,10 @@ console.log(buf.toString('ascii'));
### 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} A `Buffer` to compare to
Expand Down Expand Up @@ -1066,6 +1136,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 @@ -1144,6 +1218,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 | Integer} What to search for
Expand Down Expand Up @@ -1710,6 +1789,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

0 comments on commit b1b6b8b

Please sign in to comment.