mirror of
https://github.com/zebrajr/node.git
synced 2025-12-08 07:39:01 +01:00
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>
13 lines
262 B
JavaScript
13 lines
262 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const fs = require('fs');
|
|
const assert = require('assert');
|
|
|
|
assert.throws(function() {
|
|
fs.write(null, Buffer.allocUnsafe(1), 0, 1);
|
|
}, /TypeError/);
|
|
|
|
assert.throws(function() {
|
|
fs.write(null, '1', 0, 1);
|
|
}, /TypeError/);
|