vojtajina/node-mocks — pull request #13 by octachrome (2013-11-06 21:23:48+00:00)
Title: Support for encoding option in fs.readFile and fs.readFileSync

A very small fix to make the encoding option work in fs.readFile and fs.readFileSync. These calls will all now return a string:

fs.readFile(path, 'utf8', callback);
fs.readFile(path, {encoding: 'utf8'}, callback);
fs.readFileSync(path, 'utf8');
fs.readFileSync(path, {encoding: 'utf8'});

I added a couple of tests, and the existing tests all pass.