From 6078c37be5caf15827a0d08aa4c0028648a2c9a6 Mon Sep 17 00:00:00 2001 From: Russell Haering Date: Sun, 22 Aug 2010 23:55:22 -0700 Subject: [PATCH] Modify fs.open to use accept a callback without a mode --- lib/fs.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index a6449858f8..1e081c8793 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -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); };