Modify fs.open to use accept a callback without a mode

This commit is contained in:
Russell Haering 2010-08-22 23:55:22 -07:00 committed by Ryan Dahl
parent 748469c71c
commit 6078c37be5

View File

@ -140,8 +140,11 @@ fs.closeSync = function (fd) {
return binding.close(fd);
};
fs.open = function (path, flags, mode, callback) {
if (mode === undefined) { mode = 0666; }
fs.open = function (path, flags, mode_, callback) {
var mode = (typeof(mode_) == 'number' ? mode_ : 0666);
var callback_ = arguments[arguments.length - 1];
var callback = (typeof(callback_) == 'function' ? callback_ : null);
binding.open(path, stringToFlags(flags), mode, callback || noop);
};