diff --git a/doc/api/fs.markdown b/doc/api/fs.markdown index 76ae6a24633..445fd59c2ba 100644 --- a/doc/api/fs.markdown +++ b/doc/api/fs.markdown @@ -170,12 +170,14 @@ the completion callback. Synchronous link(2). -### fs.symlink(linkdata, path, [callback]) +### fs.symlink(linkdata, path, [type], [callback]) Asynchronous symlink(2). No arguments other than a possible exception are given to the completion callback. +`type` argument can be either `'dir'` or `'file'` (default is `'file'`). It is only +used on Windows (ignored on other platforms). -### fs.symlinkSync(linkdata, path) +### fs.symlinkSync(linkdata, path, [type]) Synchronous symlink(2). diff --git a/lib/fs.js b/lib/fs.js index 61adbdf9b99..7b61c8984c8 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -422,17 +422,17 @@ fs.readlinkSync = function(path) { return binding.readlink(pathModule._makeLong(path)); }; -fs.symlink = function(destination, path, mode_, callback) { - var mode = (typeof(mode_) == 'string' ? mode_ : null); +fs.symlink = function(destination, path, type_, callback) { + var type = (typeof(type_) == 'string' ? type_ : null); var callback_ = arguments[arguments.length - 1]; callback = (typeof(callback_) == 'function' ? callback_ : null); binding.symlink(pathModule._makeLong(destination), - pathModule._makeLong(path), mode, callback); + pathModule._makeLong(path), type, callback); }; -fs.symlinkSync = function(destination, path, mode) { +fs.symlinkSync = function(destination, path, type) { return binding.symlink(pathModule._makeLong(destination), - pathModule._makeLong(path), mode); + pathModule._makeLong(path), type); }; fs.link = function(srcpath, dstpath, callback) {