document mode argument for fs.symlink

This commit is contained in:
Igor Zinkovsky 2011-12-16 11:01:06 -08:00
parent 666aa0a343
commit d6bae2cb95
2 changed files with 9 additions and 7 deletions

View File

@ -170,12 +170,14 @@ the completion callback.
Synchronous link(2). 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 Asynchronous symlink(2). No arguments other than a possible exception are given
to the completion callback. 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). Synchronous symlink(2).

View File

@ -422,17 +422,17 @@ fs.readlinkSync = function(path) {
return binding.readlink(pathModule._makeLong(path)); return binding.readlink(pathModule._makeLong(path));
}; };
fs.symlink = function(destination, path, mode_, callback) { fs.symlink = function(destination, path, type_, callback) {
var mode = (typeof(mode_) == 'string' ? mode_ : null); var type = (typeof(type_) == 'string' ? type_ : null);
var callback_ = arguments[arguments.length - 1]; var callback_ = arguments[arguments.length - 1];
callback = (typeof(callback_) == 'function' ? callback_ : null); callback = (typeof(callback_) == 'function' ? callback_ : null);
binding.symlink(pathModule._makeLong(destination), 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), return binding.symlink(pathModule._makeLong(destination),
pathModule._makeLong(path), mode); pathModule._makeLong(path), type);
}; };
fs.link = function(srcpath, dstpath, callback) { fs.link = function(srcpath, dstpath, callback) {