mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
lib: runtime deprecate SlowBuffer
PR-URL: https://github.com/nodejs/node/pull/55175 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
2545b9e02c
commit
019efe1453
@ -695,6 +695,9 @@ Type: End-of-Life
|
|||||||
|
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
changes:
|
changes:
|
||||||
|
- version: REPLACEME
|
||||||
|
pr-url: https://github.com/nodejs/node/pull/55175
|
||||||
|
description: Runtime deprecation.
|
||||||
- version: v6.12.0
|
- version: v6.12.0
|
||||||
pr-url: https://github.com/nodejs/node/pull/10116
|
pr-url: https://github.com/nodejs/node/pull/10116
|
||||||
description: A deprecation code has been assigned.
|
description: A deprecation code has been assigned.
|
||||||
@ -703,7 +706,7 @@ changes:
|
|||||||
description: Documentation-only deprecation.
|
description: Documentation-only deprecation.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
Type: Documentation-only
|
Type: Runtime
|
||||||
|
|
||||||
The [`SlowBuffer`][] class is deprecated. Please use
|
The [`SlowBuffer`][] class is deprecated. Please use
|
||||||
[`Buffer.allocUnsafeSlow(size)`][] instead.
|
[`Buffer.allocUnsafeSlow(size)`][] instead.
|
||||||
|
@ -88,6 +88,7 @@ const {
|
|||||||
kIsEncodingSymbol,
|
kIsEncodingSymbol,
|
||||||
defineLazyProperties,
|
defineLazyProperties,
|
||||||
encodingsMap,
|
encodingsMap,
|
||||||
|
deprecate,
|
||||||
} = require('internal/util');
|
} = require('internal/util');
|
||||||
const {
|
const {
|
||||||
isAnyArrayBuffer,
|
isAnyArrayBuffer,
|
||||||
@ -1322,7 +1323,10 @@ function isAscii(input) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Buffer,
|
Buffer,
|
||||||
SlowBuffer,
|
SlowBuffer: deprecate(
|
||||||
|
SlowBuffer,
|
||||||
|
'SlowBuffer() is deprecated. Please use Buffer.allocUnsafeSlow()',
|
||||||
|
'DEP0030'),
|
||||||
transcode,
|
transcode,
|
||||||
isUtf8,
|
isUtf8,
|
||||||
isAscii,
|
isAscii,
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const buffer = require('buffer');
|
const buffer = require('buffer');
|
||||||
const SlowBuffer = buffer.SlowBuffer;
|
const SlowBuffer = buffer.SlowBuffer;
|
||||||
|
|
||||||
const ones = [1, 1, 1, 1];
|
const ones = [1, 1, 1, 1];
|
||||||
|
|
||||||
|
common.expectWarning(
|
||||||
|
'DeprecationWarning',
|
||||||
|
'SlowBuffer() is deprecated. Please use Buffer.allocUnsafeSlow()',
|
||||||
|
'DEP0030'
|
||||||
|
);
|
||||||
|
|
||||||
// Should create a Buffer
|
// Should create a Buffer
|
||||||
let sb = SlowBuffer(4);
|
let sb = SlowBuffer(4);
|
||||||
assert(sb instanceof Buffer);
|
assert(sb instanceof Buffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user