Skip to content

Commit 3d61e14

Browse files
committed
buffer: shorten deprecation warning
Shorten the deprecation warning for Buffer constructor. PR-URL: #19741 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
1 parent de0053c commit 3d61e14

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

lib/buffer.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,9 @@ function alignPool() {
140140
}
141141

142142
var bufferWarn = true;
143-
const bufferWarning = 'The Buffer() and new Buffer() constructors are not ' +
144-
'recommended for use due to security and usability ' +
145-
'concerns. Please use the Buffer.alloc(), ' +
146-
'Buffer.allocUnsafe(), or Buffer.from() construction ' +
147-
'methods instead.';
143+
const bufferWarning = 'Buffer() is deprecated due to security and usability ' +
144+
'issues. Please use the Buffer.alloc(), ' +
145+
'Buffer.allocUnsafe(), or Buffer.from() methods instead.';
148146

149147
function showFlaggedDeprecation() {
150148
if (bufferWarn) {

test/parallel/test-buffer-pending-deprecation.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33

44
const common = require('../common');
55

6-
const bufferWarning = 'The Buffer() and new Buffer() constructors are not ' +
7-
'recommended for use due to security and usability ' +
8-
'concerns. Please use the Buffer.alloc(), ' +
9-
'Buffer.allocUnsafe(), or Buffer.from() construction ' +
10-
'methods instead.';
6+
const bufferWarning = 'Buffer() is deprecated due to security and usability ' +
7+
'issues. Please use the Buffer.alloc(), ' +
8+
'Buffer.allocUnsafe(), or Buffer.from() methods instead.';
119

1210
common.expectWarning('DeprecationWarning', bufferWarning, 'DEP0005');
1311

0 commit comments

Comments
 (0)