Skip to content

Instantly share code, notes, and snippets.

@igorzi
Created December 16, 2011 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igorzi/1487452 to your computer and use it in GitHub Desktop.
Save igorzi/1487452 to your computer and use it in GitHub Desktop.
From d6bae2cb9500b91370b3a21a7155257d404107a2 Mon Sep 17 00:00:00 2001
From: Igor Zinkovsky <igorzi@microsoft.com>
Date: Fri, 16 Dec 2011 11:01:06 -0800
Subject: [PATCH] document mode argument for fs.symlink
---
doc/api/fs.markdown | 6 ++++--
lib/fs.js | 10 +++++-----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/doc/api/fs.markdown b/doc/api/fs.markdown
index 76ae6a2..445fd59 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 61adbdf..7b61c89 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) {
--
1.7.4.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment