DEP0005:Buffer() 构造函数


¥DEP0005: Buffer() constructor

类型:应用(仅限非 node_modules 代码)

¥Type: Application (non-node_modules code only)

由于可能导致意外安全问题的 API 可用性问题,Buffer() 函数和 new Buffer() 构造函数已弃用。

¥The Buffer() function and new Buffer() constructor are deprecated due to API usability issues that can lead to accidental security issues.

作为替代方案,使用以下方法之一构造 Buffer 对象:

¥As an alternative, use one of the following methods of constructing Buffer objects:

如果没有 --pending-deprecation,运行时警告只会出现在不在 node_modules 中的代码中。这意味着在依赖中使用 Buffer() 不会有弃用警告。对于 --pending-deprecation,无论在何处使用 Buffer(),都会产生运行时警告。

¥Without --pending-deprecation, runtime warnings occur only for code not in node_modules. This means there will not be deprecation warnings for Buffer() usage in dependencies. With --pending-deprecation, a runtime warning results no matter where the Buffer() usage occurs.