From 85ab4a5f1281c4e1dd06450ac7bd3250326267fa Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 25 Jan 2016 15:00:06 -0800 Subject: buffer: add .from(), .alloc() and .allocUnsafe() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Several changes: * Soft-Deprecate Buffer() constructors * Add `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()` * Add `--zero-fill-buffers` command line option * Add byteOffset and length to `new Buffer(arrayBuffer)` constructor * buffer.fill('') previously had no effect, now zero-fills * Update the docs PR-URL: https://github.com/nodejs/node/pull/4682 Reviewed-By: Сковорода Никита Андреевич Reviewed-By: Stephen Belanger --- benchmark/net/net-pipe.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'benchmark/net/net-pipe.js') diff --git a/benchmark/net/net-pipe.js b/benchmark/net/net-pipe.js index ea8af249a3..b6e95a8b75 100644 --- a/benchmark/net/net-pipe.js +++ b/benchmark/net/net-pipe.js @@ -23,8 +23,7 @@ function main(conf) { switch (type) { case 'buf': - chunk = new Buffer(len); - chunk.fill('x'); + chunk = Buffer.alloc(len, 'x'); break; case 'utf': encoding = 'utf8'; -- cgit v1.2.3