• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const fixtures = require('../common/fixtures');
4const assert = require('assert');
5const fs = require('fs');
6const filepath = fixtures.path('x.txt');
7const fd = fs.openSync(filepath, 'r');
8const bufferAsync = Buffer.alloc(0);
9const bufferSync = Buffer.alloc(0);
10
11fs.read(fd, bufferAsync, 0, 0, 0, common.mustCall((err, bytesRead) => {
12  assert.strictEqual(bytesRead, 0);
13  assert.deepStrictEqual(bufferAsync, Buffer.alloc(0));
14}));
15
16const r = fs.readSync(fd, bufferSync, 0, 0, 0);
17assert.deepStrictEqual(bufferSync, Buffer.alloc(0));
18assert.strictEqual(r, 0);
19