@@ -642,6 +642,10 @@ It can be constructed in a variety of ways.
642
642
<!-- YAML
643
643
added: v5.10.0
644
644
changes:
645
+ - version: v20.0.0
646
+ pr-url: https://github.com/nodejs/node/pull/45796
647
+ description: Throw ERR_INVALID_ARG_TYPE or ERR_OUT_OF_RANGE instead of
648
+ ERR_INVALID_ARG_VALUE for invalid input arguments.
645
649
- version: v15.0.0
646
650
pr-url: https://github.com/nodejs/node/pull/34682
647
651
description: Throw ERR_INVALID_ARG_VALUE instead of ERR_INVALID_OPT_VALUE
@@ -688,7 +692,7 @@ console.log(buf);
688
692
```
689
693
690
694
If ` size ` is larger than
691
- [ ` buffer.constants.MAX_LENGTH ` ] [ ] or smaller than 0, [ ` ERR_INVALID_ARG_VALUE ` ] [ ]
695
+ [ ` buffer.constants.MAX_LENGTH ` ] [ ] or smaller than 0, [ ` ERR_OUT_OF_RANGE ` ] [ ]
692
696
is thrown.
693
697
694
698
If ` fill ` is specified, the allocated ` Buffer ` will be initialized by calling
@@ -745,6 +749,10 @@ A `TypeError` will be thrown if `size` is not a number.
745
749
<!-- YAML
746
750
added: v5.10.0
747
751
changes:
752
+ - version: v20.0.0
753
+ pr-url: https://github.com/nodejs/node/pull/45796
754
+ description: Throw ERR_INVALID_ARG_TYPE or ERR_OUT_OF_RANGE instead of
755
+ ERR_INVALID_ARG_VALUE for invalid input arguments.
748
756
- version: v15.0.0
749
757
pr-url: https://github.com/nodejs/node/pull/34682
750
758
description: Throw ERR_INVALID_ARG_VALUE instead of ERR_INVALID_OPT_VALUE
@@ -757,7 +765,7 @@ changes:
757
765
* ` size ` {integer} The desired length of the new ` Buffer ` .
758
766
759
767
Allocates a new ` Buffer ` of ` size ` bytes. If ` size ` is larger than
760
- [ ` buffer.constants.MAX_LENGTH ` ] [ ] or smaller than 0, [ ` ERR_INVALID_ARG_VALUE ` ] [ ]
768
+ [ ` buffer.constants.MAX_LENGTH ` ] [ ] or smaller than 0, [ ` ERR_OUT_OF_RANGE ` ] [ ]
761
769
is thrown.
762
770
763
771
The underlying memory for ` Buffer ` instances created in this way is _ not
@@ -815,6 +823,10 @@ additional performance that [`Buffer.allocUnsafe()`][] provides.
815
823
<!-- YAML
816
824
added: v5.12.0
817
825
changes:
826
+ - version: v20.0.0
827
+ pr-url: https://github.com/nodejs/node/pull/45796
828
+ description: Throw ERR_INVALID_ARG_TYPE or ERR_OUT_OF_RANGE instead of
829
+ ERR_INVALID_ARG_VALUE for invalid input arguments.
818
830
- version: v15.0.0
819
831
pr-url: https://github.com/nodejs/node/pull/34682
820
832
description: Throw ERR_INVALID_ARG_VALUE instead of ERR_INVALID_OPT_VALUE
@@ -824,7 +836,7 @@ changes:
824
836
* ` size ` {integer} The desired length of the new ` Buffer ` .
825
837
826
838
Allocates a new ` Buffer ` of ` size ` bytes. If ` size ` is larger than
827
- [ ` buffer.constants.MAX_LENGTH ` ] [ ] or smaller than 0, [ ` ERR_INVALID_ARG_VALUE ` ] [ ]
839
+ [ ` buffer.constants.MAX_LENGTH ` ] [ ] or smaller than 0, [ ` ERR_OUT_OF_RANGE ` ] [ ]
828
840
is thrown. A zero-length ` Buffer ` is created if ` size ` is 0.
829
841
830
842
The underlying memory for ` Buffer ` instances created in this way is _ not
@@ -5465,7 +5477,6 @@ introducing security vulnerabilities into an application.
5465
5477
[ `Buffer.from(string)` ] : #static-method-bufferfromstring-encoding
5466
5478
[ `Buffer.poolSize` ] : #class-property-bufferpoolsize
5467
5479
[ `DataView` ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
5468
- [ `ERR_INVALID_ARG_VALUE` ] : errors.md#err_invalid_arg_value
5469
5480
[ `ERR_INVALID_BUFFER_SIZE` ] : errors.md#err_invalid_buffer_size
5470
5481
[ `ERR_OUT_OF_RANGE` ] : errors.md#err_out_of_range
5471
5482
[ `File` ] : https://developer.mozilla.org/en-US/docs/Web/API/File
0 commit comments