From fd4ffe719f5c42620fdd52bf4bd47d6255b7a972 Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Mon, 30 Sep 2024 10:07:47 -0300 Subject: [PATCH] lib: runtime deprecate SlowBuffer --- doc/api/deprecations.md | 5 ++++- lib/buffer.js | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index f10265b9ddd98a..188fedada93f35 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -695,6 +695,9 @@ Type: End-of-Life -Type: Documentation-only +Type: Runtime The [`SlowBuffer`][] class is deprecated. Please use [`Buffer.allocUnsafeSlow(size)`][] instead. diff --git a/lib/buffer.js b/lib/buffer.js index 6294eae2fb5093..9b116eabe69d36 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -88,6 +88,7 @@ const { kIsEncodingSymbol, defineLazyProperties, encodingsMap, + deprecate, } = require('internal/util'); const { isAnyArrayBuffer, @@ -1322,7 +1323,10 @@ function isAscii(input) { module.exports = { Buffer, - SlowBuffer, + SlowBuffer: deprecate( + SlowBuffer, + 'SlowBuffer() is deprecated. Please use Buffer.allowUnsafeSlow()', + 'DEP0030'), transcode, isUtf8, isAscii,