node/test/simple/test-fs-readfile-empty.js

19 lines
402 B
JavaScript
Raw Normal View History

2010-12-05 07:20:34 +08:00
var common = require('../common');
var assert = require('assert');
2010-05-14 03:42:17 +08:00
var
path = require('path'),
fs = require('fs'),
fn = path.join(common.fixturesDir, 'empty.txt');
2010-05-14 03:42:17 +08:00
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'));