mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 13:40:37 +00:00

PR-URL: https://github.com/nodejs/node/pull/16017 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
19 lines
610 B
JavaScript
19 lines
610 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const filepath = fixtures.path('x.txt');
|
|
const fd = fs.openSync(filepath, 'r');
|
|
const bufferAsync = Buffer.alloc(0);
|
|
const bufferSync = Buffer.alloc(0);
|
|
|
|
fs.read(fd, bufferAsync, 0, 0, 0, common.mustCall((err, bytesRead) => {
|
|
assert.strictEqual(bytesRead, 0);
|
|
assert.deepStrictEqual(bufferAsync, Buffer.alloc(0));
|
|
}));
|
|
|
|
const r = fs.readSync(fd, bufferSync, 0, 0, 0);
|
|
assert.deepStrictEqual(bufferSync, Buffer.alloc(0));
|
|
assert.strictEqual(r, 0);
|