NodeJS Buffer.poolSize 是 NodeJS Buffer 中 Buffer 类的一个属性。它将大小(以字节为单位)分配给 Buffer 实例,这些实例稍后由 NodeJs 用于池化。
poolSize 的默认值为 8192 字节。可以通过向 poolSize 赋值来更改该值。
语法
以下是NodeJS Buffer.poolSize 属性的语法 -
Buffer.poolSize = value
例
在此示例中,将仅控制台 NodeJS Buffer.poolSize 以查看默认值。
console.log("The poolSize value is :" + Buffer.poolSize);
输出
The poolSize value is :8192
例
让我们将 poolSize 更改为我们需要的值,如下例所示。
console.log("The poolSize value is :" + Buffer.poolSize);
Buffer.poolSize = 1536
console.log("The poolSize value after changing is :"+ Buffer.poolSize);
输出
The poolSize value is :8192
The poolSize value after changing is :1536
The poolSize value after changing is :1536