diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-02-21 23:38:42 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-02-24 02:06:31 +0100 |
commit | 7b6e30215d8155617c177bdc3f99e0b3b41d8540 (patch) | |
tree | 5658300527e3db27af27badeec8b16acbc152bfb /doc/api/buffer.md | |
parent | a0af30533c43fe6939b8a25733a69a137b3a472d (diff) | |
download | android-node-v8-7b6e30215d8155617c177bdc3f99e0b3b41d8540.tar.gz android-node-v8-7b6e30215d8155617c177bdc3f99e0b3b41d8540.tar.bz2 android-node-v8-7b6e30215d8155617c177bdc3f99e0b3b41d8540.zip |
doc: add changelogs for buffer
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'doc/api/buffer.md')
-rw-r--r-- | doc/api/buffer.md | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 4efbd93599..e79fe978e2 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -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 @@ -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. @@ -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. @@ -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 @@ -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. @@ -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 @@ -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: @@ -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` @@ -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 @@ -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 @@ -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 @@ -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 @@ -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` |