diff options
author | James M Snell <jasnell@gmail.com> | 2016-01-26 02:00:06 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2016-03-16 18:34:02 +0300 |
commit | 85ab4a5f1281c4e1dd06450ac7bd3250326267fa (patch) | |
tree | 7a51edfc5d6efc231cf821d575c9ca4a26d0545f /benchmark/http/end-vs-write-end.js | |
parent | 90a5fc20be22b4278a01bc58acba0cb732da0140 (diff) |
buffer: add .from(), .alloc() and .allocUnsafe()
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: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Diffstat (limited to 'benchmark/http/end-vs-write-end.js')
-rw-r--r-- | benchmark/http/end-vs-write-end.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/benchmark/http/end-vs-write-end.js b/benchmark/http/end-vs-write-end.js index 4e12e543f0b..0cdc88111de 100644 --- a/benchmark/http/end-vs-write-end.js +++ b/benchmark/http/end-vs-write-end.js @@ -23,8 +23,7 @@ function main(conf) { var len = conf.kb * 1024; switch (conf.type) { case 'buf': - chunk = new Buffer(len); - chunk.fill('x'); + chunk = Buffer.alloc(len, 'x'); break; case 'utf': chunk = new Array(len / 2 + 1).join('ü'); |