| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5966650 commit 2d67741
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -101,6 +101,9 @@ off a shared internal memory pool if `size` is less than or equal to half | |||
| 101 | 101 | use the shared internal memory pool. | |
| 102 | 102 | ||
| 103 | 103 | ### The `--zero-fill-buffers` command line option | |
| 104 | + <!-- YAML | ||
| 105 | + added: v5.10.0 | ||
| 106 | + --> | ||
| 104 | 107 | ||
| 105 | 108 | Node.js can be started using the `--zero-fill-buffers` command line option to | |
| 106 | 109 | force all newly allocated `Buffer` instances created using either | |
@@ -261,6 +264,9 @@ The Buffer class is a global type for dealing with binary data directly. | |||
| 261 | 264 | It can be constructed in a variety of ways. | |
| 262 | 265 | ||
| 263 | 266 | ### new Buffer(array) | |
| 267 | + <!-- YAML | ||
| 268 | + deprecated: v6.0.0 | ||
| 269 | + --> | ||
| 264 | 270 | ||
| 265 | 271 | Stability: 0 - Deprecated: Use [`Buffer.from(array)`][buffer_from_array] | |
| 266 | 272 | instead. | |
@@ -276,6 +282,9 @@ const buf = new Buffer([0x62,0x75,0x66,0x66,0x65,0x72]); | |||
| 276 | 282 | ``` | |
| 277 | 283 | ||
| 278 | 284 | ### new Buffer(buffer) | |
| 285 | + <!-- YAML | ||
| 286 | + deprecated: v6.0.0 | ||
| 287 | + --> | ||
| 279 | 288 | ||
| 280 | 289 | Stability: 0 - Deprecated: Use [`Buffer.from(buffer)`][buffer_from_buffer] | |
| 281 | 290 | instead. | |
@@ -296,6 +305,9 @@ console.log(buf2.toString()); | |||
| 296 | 305 | ``` | |
| 297 | 306 | ||
| 298 | 307 | ### new Buffer(arrayBuffer[, byteOffset [, length]]) | |
| 308 | + <!-- YAML | ||
| 309 | + deprecated: v6.0.0 | ||
| 310 | + --> | ||
| 299 | 311 | ||
| 300 | 312 | Stability: 0 - Deprecated: Use | |
| 301 | 313 | [`Buffer.from(arrayBuffer[, byteOffset [, length]])`][buffer_from_arraybuf] | |
@@ -331,6 +343,9 @@ console.log(buf); | |||
| 331 | 343 | ``` | |
| 332 | 344 | ||
| 333 | 345 | ### new Buffer(size) | |
| 346 | + <!-- YAML | ||
| 347 | + deprecated: v6.0.0 | ||
| 348 | + --> | ||
| 334 | 349 | ||
| 335 | 350 | Stability: 0 - Deprecated: Use | |
| 336 | 351 | [`Buffer.alloc(size[, fill[, encoding]])`][buffer_alloc] instead (also | |
@@ -360,6 +375,9 @@ console.log(buf); | |||
| 360 | 375 | ``` | |
| 361 | 376 | ||
| 362 | 377 | ### new Buffer(str[, encoding]) | |
| 378 | + <!-- YAML | ||
| 379 | + deprecated: v6.0.0 | ||
| 380 | + --> | ||
| 363 | 381 | ||
| 364 | 382 | Stability: 0 - Deprecated: | |
| 365 | 383 | Use [`Buffer.from(str[, encoding])`][buffer_from_string] instead. | |
@@ -383,6 +401,9 @@ console.log(buf2.toString()); | |||
| 383 | 401 | ``` | |
| 384 | 402 | ||
| 385 | 403 | ### Class Method: Buffer.alloc(size[, fill[, encoding]]) | |
| 404 | + <!-- YAML | ||
| 405 | + added: v5.10.0 | ||
| 406 | + --> | ||
| 386 | 407 | ||
| 387 | 408 | * `size` {Number} | |
| 388 | 409 | * `fill` {Value} Default: `undefined` | |
@@ -427,6 +448,9 @@ contents will *never contain sensitive data*. | |||
| 427 | 448 | A `TypeError` will be thrown if `size` is not a number. | |
| 428 | 449 | ||
| 429 | 450 | ### Class Method: Buffer.allocUnsafe(size) | |
| 451 | + <!-- YAML | ||
| 452 | + added: v5.10.0 | ||
| 453 | + --> | ||
| 430 | 454 | ||
| 431 | 455 | * `size` {Number} | |
| 432 | 456 | ||
@@ -469,6 +493,9 @@ difference is subtle but can be important when an application requires the | |||
| 469 | 493 | additional performance that `Buffer.allocUnsafe(size)` provides. | |
| 470 | 494 | ||
| 471 | 495 | ### Class Method: Buffer.allocUnsafeSlow(size) | |
| 496 | + <!-- YAML | ||
| 497 | + added: v5.10.0 | ||
| 498 | + --> | ||
| 472 | 499 | ||
| 473 | 500 | * `size` {Number} | |
| 474 | 501 | ||
@@ -541,6 +568,9 @@ returns the actual byte length. | |||
| 541 | 568 | Otherwise, converts to `String` and returns the byte length of string. | |
| 542 | 569 | ||
| 543 | 570 | ### Class Method: Buffer.compare(buf1, buf2) | |
| 571 | + <!-- YAML | ||
| 572 | + added: v0.11.13 | ||
| 573 | + --> | ||
| 544 | 574 | ||
| 545 | 575 | * `buf1` {Buffer} | |
| 546 | 576 | * `buf2` {Buffer} | |
@@ -555,6 +585,9 @@ arr.sort(Buffer.compare); | |||
| 555 | 585 | ``` | |
| 556 | 586 | ||
| 557 | 587 | ### Class Method: Buffer.concat(list[, totalLength]) | |
| 588 | + <!-- YAML | ||
| 589 | + added: v0.7.11 | ||
| 590 | + --> | ||
| 558 | 591 | ||
| 559 | 592 | * `list` {Array} List of Buffer objects to concat | |
| 560 | 593 | * `totalLength` {Number} Total length of the Buffers in the list | |
@@ -590,6 +623,9 @@ console.log(bufA.length); | |||
| 590 | 623 | ``` | |
| 591 | 624 | ||
| 592 | 625 | ### Class Method: Buffer.from(array) | |
| 626 | + <!-- YAML | ||
| 627 | + added: v3.0.0 | ||
| 628 | + --> | ||
| 593 | 629 | ||
| 594 | 630 | * `array` {Array} | |
| 595 | 631 | ||
@@ -604,6 +640,9 @@ const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); | |||
| 604 | 640 | A `TypeError` will be thrown if `array` is not an `Array`. | |
| 605 | 641 | ||
| 606 | 642 | ### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) | |
| 643 | + <!-- YAML | ||
| 644 | + added: v5.10.0 | ||
| 645 | + --> | ||
| 607 | 646 | ||
| 608 | 647 | * `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or | |
| 609 | 648 | a `new ArrayBuffer()` | |
@@ -644,6 +683,9 @@ console.log(buf.length); | |||
| 644 | 683 | A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. | |
| 645 | 684 | ||
| 646 | 685 | ### Class Method: Buffer.from(buffer) | |
| 686 | + <!-- YAML | ||
| 687 | + added: v3.0.0 | ||
| 688 | + --> | ||
| 647 | 689 | ||
| 648 | 690 | * `buffer` {Buffer} | |
| 649 | 691 | ||
@@ -663,6 +705,9 @@ console.log(buf2.toString()); | |||
| 663 | 705 | A `TypeError` will be thrown if `buffer` is not a `Buffer`. | |
| 664 | 706 | ||
| 665 | 707 | ### Class Method: Buffer.from(str[, encoding]) | |
| 708 | + <!-- YAML | ||
| 709 | + added: v5.10.0 | ||
| 710 | + --> | ||
| 666 | 711 | ||
| 667 | 712 | * `str` {String} String to encode. | |
| 668 | 713 | * `encoding` {String} Encoding to use, Default: `'utf8'` | |
@@ -693,6 +738,9 @@ A `TypeError` will be thrown if `str` is not a string. | |||
| 693 | 738 | Returns 'true' if `obj` is a Buffer. | |
| 694 | 739 | ||
| 695 | 740 | ### Class Method: Buffer.isEncoding(encoding) | |
| 741 | + <!-- YAML | ||
| 742 | + added: v0.9.1 | ||
| 743 | + --> | ||
| 696 | 744 | ||
| 697 | 745 | * `encoding` {String} The encoding string to test | |
| 698 | 746 | * Return: {Boolean} | |
@@ -701,9 +749,10 @@ Returns true if the `encoding` is a valid encoding argument, or false | |||
| 701 | 749 | otherwise. | |
| 702 | 750 | ||
| 703 | 751 | ### buf[index] | |
| 704 | - | ||
| 705 | - <!--type=property--> | ||
| 706 | - <!--name=[index]--> | ||
| 752 | + <!-- YAML | ||
| 753 | + type: property | ||
| 754 | + name: [index] | ||
| 755 | + --> | ||
| 707 | 756 | ||
| 708 | 757 | The index operator `[index]` can be used to get and set the octet at position | |
| 709 | 758 | `index` in the Buffer. The values refer to individual bytes, so the legal value | |
@@ -724,6 +773,9 @@ console.log(buf.toString('ascii')); | |||
| 724 | 773 | ``` | |
| 725 | 774 | ||
| 726 | 775 | ### buf.compare(target[, targetStart[, targetEnd[, sourceStart[, sourceEnd]]]]) | |
| 776 | + <!-- YAML | ||
| 777 | + added: v0.11.13 | ||
| 778 | + --> | ||
| 727 | 779 | ||
| 728 | 780 | * `target` {Buffer} | |
| 729 | 781 | * `targetStart` {Integer} The offset within `target` at which to begin | |
@@ -827,6 +879,9 @@ console.log(buf.toString()); | |||
| 827 | 879 | ``` | |
| 828 | 880 | ||
| 829 | 881 | ### buf.entries() | |
| 882 | + <!-- YAML | ||
| 883 | + added: v1.1.0 | ||
| 884 | + --> | ||
| 830 | 885 | ||
| 831 | 886 | * Return: {Iterator} | |
| 832 | 887 | ||
@@ -848,6 +903,9 @@ for (var pair of buf.entries()) { | |||
| 848 | 903 | ``` | |
| 849 | 904 | ||
| 850 | 905 | ### buf.equals(otherBuffer) | |
| 906 | + <!-- YAML | ||
| 907 | + added: v1.0.0 | ||
| 908 | + --> | ||
| 851 | 909 | ||
| 852 | 910 | * `otherBuffer` {Buffer} | |
| 853 | 911 | * Return: {Boolean} | |
@@ -867,6 +925,9 @@ console.log(buf1.equals(buf3)); | |||
| 867 | 925 | ``` | |
| 868 | 926 | ||
| 869 | 927 | ### buf.fill(value[, offset[, end]][, encoding]) | |
| 928 | + <!-- YAML | ||
| 929 | + added: v0.5.0 | ||
| 930 | + --> | ||
| 870 | 931 | ||
| 871 | 932 | * `value` {String|Buffer|Number} | |
| 872 | 933 | * `offset` {Number} Default: 0 | |
@@ -899,6 +960,9 @@ Buffer(3).fill('\u0222'); | |||
| 899 | 960 | ``` | |
| 900 | 961 | ||
| 901 | 962 | ### buf.indexOf(value[, byteOffset][, encoding]) | |
| 963 | + <!-- YAML | ||
| 964 | + added: v1.5.0 | ||
| 965 | + --> | ||
| 902 | 966 | ||
| 903 | 967 | * `value` {String|Buffer|Number} | |
| 904 | 968 | * `byteOffset` {Number} Default: 0 | |
@@ -936,6 +1000,9 @@ utf16Buffer.indexOf('\u03a3', -4, 'ucs2'); | |||
| 936 | 1000 | ``` | |
| 937 | 1001 | ||
| 938 | 1002 | ### buf.includes(value[, byteOffset][, encoding]) | |
| 1003 | + <!-- YAML | ||
| 1004 | + added: v5.3.0 | ||
| 1005 | + --> | ||
| 939 | 1006 | ||
| 940 | 1007 | * `value` {String|Buffer|Number} | |
| 941 | 1008 | * `byteOffset` {Number} Default: 0 | |
@@ -969,6 +1036,9 @@ buf.includes('this', 4); | |||
| 969 | 1036 | ``` | |
| 970 | 1037 | ||
| 971 | 1038 | ### buf.keys() | |
| 1039 | + <!-- YAML | ||
| 1040 | + added: v1.1.0 | ||
| 1041 | + --> | ||
| 972 | 1042 | ||
| 973 | 1043 | * Return: {Iterator} | |
| 974 | 1044 | ||
@@ -989,6 +1059,9 @@ for (var key of buf.keys()) { | |||
| 989 | 1059 | ``` | |
| 990 | 1060 | ||
| 991 | 1061 | ### buf.lastIndexOf(value[, byteOffset][, encoding]) | |
| 1062 | + <!-- YAML | ||
| 1063 | + added: v6.0.0 | ||
| 1064 | + --> | ||
| 992 | 1065 | ||
| 993 | 1066 | * `value` {String|Buffer|Number} | |
| 994 | 1067 | * `byteOffset` {Number} Default: `buf.length` | |
@@ -1195,6 +1268,9 @@ buf.readInt32LE(1); | |||
| 1195 | 1268 | ||
| 1196 | 1269 | ### buf.readIntBE(offset, byteLength[, noAssert]) | |
| 1197 | 1270 | ### buf.readIntLE(offset, byteLength[, noAssert]) | |
| 1271 | + <!-- YAML | ||
| 1272 | + added: v1.0.0 | ||
| 1273 | + --> | ||
| 1198 | 1274 | ||
| 1199 | 1275 | * `offset` {Number} `0 <= offset <= buf.length - byteLength` | |
| 1200 | 1276 | * `byteLength` {Number} `0 < byteLength <= 6` | |
@@ -1299,6 +1375,9 @@ console.log(buf.readUInt32LE(0)); | |||
| 1299 | 1375 | ||
| 1300 | 1376 | ### buf.readUIntBE(offset, byteLength[, noAssert]) | |
| 1301 | 1377 | ### buf.readUIntLE(offset, byteLength[, noAssert]) | |
| 1378 | + <!-- YAML | ||
| 1379 | + added: v1.0.0 | ||
| 1380 | + --> | ||
| 1302 | 1381 | ||
| 1303 | 1382 | * `offset` {Number} `0 <= offset <= buf.length - byteLength` | |
| 1304 | 1383 | * `byteLength` {Number} `0 < byteLength <= 6` | |
@@ -1368,6 +1447,9 @@ buf.slice(-5, -2).toString(); | |||
| 1368 | 1447 | ``` | |
| 1369 | 1448 | ||
| 1370 | 1449 | ### buf.swap16() | |
| 1450 | + <!-- YAML | ||
| 1451 | + added: v5.10.0 | ||
| 1452 | + --> | ||
| 1371 | 1453 | ||
| 1372 | 1454 | * Return: {Buffer} | |
| 1373 | 1455 | ||
@@ -1386,6 +1468,9 @@ console.log(buf); | |||
| 1386 | 1468 | ``` | |
| 1387 | 1469 | ||
| 1388 | 1470 | ### buf.swap32() | |
| 1471 | + <!-- YAML | ||
| 1472 | + added: v5.10.0 | ||
| 1473 | + --> | ||
| 1389 | 1474 | ||
| 1390 | 1475 | * Return: {Buffer} | |
| 1391 | 1476 | ||
@@ -1429,6 +1514,9 @@ buf.toString(undefined,0,5); | |||
| 1429 | 1514 | ``` | |
| 1430 | 1515 | ||
| 1431 | 1516 | ### buf.toJSON() | |
| 1517 | + <!-- YAML | ||
| 1518 | + added: v0.9.2 | ||
| 1519 | + --> | ||
| 1432 | 1520 | ||
| 1433 | 1521 | * Return: {Object} | |
| 1434 | 1522 | ||
@@ -1455,6 +1543,9 @@ console.log(copy.toString()); | |||
| 1455 | 1543 | ``` | |
| 1456 | 1544 | ||
| 1457 | 1545 | ### buf.values() | |
| 1546 | + <!-- YAML | ||
| 1547 | + added: v1.1.0 | ||
| 1548 | + --> | ||
| 1458 | 1549 | ||
| 1459 | 1550 | * Return: {Iterator} | |
| 1460 | 1551 | ||
@@ -1657,6 +1748,9 @@ console.log(buf); | |||
| 1657 | 1748 | ||
| 1658 | 1749 | ### buf.writeIntBE(value, offset, byteLength[, noAssert]) | |
| 1659 | 1750 | ### buf.writeIntLE(value, offset, byteLength[, noAssert]) | |
| 1751 | + <!-- YAML | ||
| 1752 | + added: v1.0.0 | ||
| 1753 | + --> | ||
| 1660 | 1754 | ||
| 1661 | 1755 | * `value` {Number} Bytes to be written to Buffer | |
| 1662 | 1756 | * `offset` {Number} `0 <= offset <= buf.length - byteLength` | |
@@ -1821,6 +1915,9 @@ Note that this is a property on the `buffer` module as returned by | |||
| 1821 | 1915 | `require('buffer')`, not on the Buffer global or a Buffer instance. | |
| 1822 | 1916 | ||
| 1823 | 1917 | ## Class: SlowBuffer | |
| 1918 | + <!-- YAML | ||
| 1919 | + deprecated: v6.0.0 | ||
| 1920 | + --> | ||
| 1824 | 1921 | ||
| 1825 | 1922 | Stability: 0 - Deprecated: Use | |
| 1826 | 1923 | [`Buffer.allocUnsafeSlow(size)`][buffer_allocunsafeslow] instead. | |
@@ -1854,6 +1951,9 @@ Use of `SlowBuffer` should be used only as a last resort *after* a developer | |||
| 1854 | 1951 | has observed undue memory retention in their applications. | |
| 1855 | 1952 | ||
| 1856 | 1953 | ### new SlowBuffer(size) | |
| 1954 | + <!-- YAML | ||
| 1955 | + deprecated: v6.0.0 | ||
| 1956 | + --> | ||
| 1857 | 1957 | ||
| 1858 | 1958 | Stability: 0 - Deprecated: Use | |
| 1859 | 1959 | [`Buffer.allocUnsafeSlow(size)`][buffer_allocunsafeslow] instead. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments