mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05: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
536 B
JavaScript
19 lines
536 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 expected = '';
|
|
|
|
fs.read(fd, 0, 0, 'utf-8', common.mustCall((err, str, bytesRead) => {
|
|
assert.ok(!err);
|
|
assert.strictEqual(str, expected);
|
|
assert.strictEqual(bytesRead, 0);
|
|
}));
|
|
|
|
const r = fs.readSync(fd, 0, 0, 'utf-8');
|
|
assert.strictEqual(r[0], expected);
|
|
assert.strictEqual(r[1], 0);
|