mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
PR-URL: https://github.com/nodejs/node/pull/17610 Refs: https://github.com/nodejs/node/pull/17054#discussion_r155406755 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
22 lines
466 B
JavaScript
22 lines
466 B
JavaScript
'use strict';
|
|
require('../common');
|
|
|
|
// Trivial test of fs.readFile on an empty file.
|
|
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
const fn = fixtures.path('empty.txt');
|
|
|
|
fs.readFile(fn, function(err, data) {
|
|
assert.ok(data);
|
|
});
|
|
|
|
fs.readFile(fn, 'utf8', function(err, data) {
|
|
assert.strictEqual('', data);
|
|
});
|
|
|
|
assert.ok(fs.readFileSync(fn));
|
|
assert.strictEqual('', fs.readFileSync(fn, 'utf8'));
|