mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
3d61e14704
Shorten the deprecation warning for Buffer constructor. PR-URL: https://github.com/nodejs/node/pull/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>
19 lines
586 B
JavaScript
19 lines
586 B
JavaScript
// Flags: --pending-deprecation --no-warnings
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const bufferWarning = 'Buffer() is deprecated due to security and usability ' +
|
|
'issues. Please use the Buffer.alloc(), ' +
|
|
'Buffer.allocUnsafe(), or Buffer.from() methods instead.';
|
|
|
|
common.expectWarning('DeprecationWarning', bufferWarning, 'DEP0005');
|
|
|
|
// This is used to make sure that a warning is only emitted once even though
|
|
// `new Buffer()` is called twice.
|
|
process.on('warning', common.mustCall());
|
|
|
|
new Buffer(10);
|
|
|
|
new Buffer(10);
|