buffer: move SlowBuffer to EOL

`SlowBuffer` has been deprecated for many years now. Let's remove it.

PR-URL: https://github.com/nodejs/node/pull/58008
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
James M Snell 2025-04-24 07:50:22 -07:00
parent 145c6a2693
commit 647175ee0b
23 changed files with 61 additions and 118 deletions

View file

@ -52,7 +52,6 @@ const {
TypedArrayPrototypeSet,
TypedArrayPrototypeSlice,
Uint8Array,
Uint8ArrayPrototype,
} = primordials;
const {
@ -89,7 +88,6 @@ const {
kIsEncodingSymbol,
defineLazyProperties,
encodingsMap,
deprecate,
} = require('internal/util');
const {
isAnyArrayBuffer,
@ -411,25 +409,15 @@ Buffer.allocUnsafe = function allocUnsafe(size) {
};
/**
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled
* Buffer instance that is not allocated off the pre-initialized pool.
* If `--zero-fill-buffers` is set, will zero-fill the buffer.
* By default creates a non-zero-filled Buffer instance that is not allocated
* off the pre-initialized pool. If `--zero-fill-buffers` is set, will zero-fill
* the buffer.
*/
Buffer.allocUnsafeSlow = function allocUnsafeSlow(size) {
validateNumber(size, 'size', 0, kMaxLength);
return createUnsafeBuffer(size);
};
// If --zero-fill-buffers command line argument is set, a zero-filled
// buffer is returned.
function SlowBuffer(size) {
validateNumber(size, 'size', 0, kMaxLength);
return createUnsafeBuffer(size);
}
ObjectSetPrototypeOf(SlowBuffer.prototype, Uint8ArrayPrototype);
ObjectSetPrototypeOf(SlowBuffer, Uint8Array);
function allocate(size) {
if (size <= 0) {
return new FastBuffer();
@ -1331,10 +1319,6 @@ function isAscii(input) {
module.exports = {
Buffer,
SlowBuffer: deprecate(
SlowBuffer,
'SlowBuffer() is deprecated. Please use Buffer.allocUnsafeSlow()',
'DEP0030'),
transcode,
isUtf8,
isAscii,