Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5bf5688

Browse filesBrowse files
yorkieMyles Borins
authored andcommitted
fs,doc: use target instead of destination
PR-URL: #3912 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Bert Belder <bertbelder@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 22d2887 commit 5bf5688
Copy full SHA for 5bf5688

File tree

Expand file treeCollapse file tree

3 files changed

+20
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+20
-14
lines changed
Open diff view settings
Collapse file

‎doc/api/fs.markdown‎

Copy file name to clipboardExpand all lines: doc/api/fs.markdown
+9-3Lines changed: 9 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -664,16 +664,22 @@ information.
664664

665665
Synchronous stat(2). Returns an instance of `fs.Stats`.
666666

667-
## fs.symlink(destination, path[, type], callback)
667+
## fs.symlink(target, path[, type], callback)
668668

669669
Asynchronous symlink(2). No arguments other than a possible exception are given
670670
to the completion callback.
671671
The `type` argument can be set to `'dir'`, `'file'`, or `'junction'` (default
672672
is `'file'`) and is only available on Windows (ignored on other platforms).
673673
Note that Windows junction points require the destination path to be absolute. When using
674-
`'junction'`, the `destination` argument will automatically be normalized to absolute path.
674+
`'junction'`, the `target` argument will automatically be normalized to absolute path.
675675

676-
## fs.symlinkSync(destination, path[, type])
676+
Here is an example below:
677+
678+
fs.symlink('./foo', './new-port');
679+
680+
It would create a symlic link named with "new-port" that points to "foo".
681+
682+
## fs.symlinkSync(target, path[, type])
677683

678684
Synchronous symlink(2). Returns `undefined`.
679685

Collapse file

‎lib/fs.js‎

Copy file name to clipboardExpand all lines: lib/fs.js
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -872,29 +872,29 @@ function preprocessSymlinkDestination(path, type, linkPath) {
872872
}
873873
}
874874

875-
fs.symlink = function(destination, path, type_, callback_) {
875+
fs.symlink = function(target, path, type_, callback_) {
876876
var type = (typeof type_ === 'string' ? type_ : null);
877877
var callback = makeCallback(arguments[arguments.length - 1]);
878878

879-
if (!nullCheck(destination, callback)) return;
879+
if (!nullCheck(target, callback)) return;
880880
if (!nullCheck(path, callback)) return;
881881

882882
var req = new FSReqWrap();
883883
req.oncomplete = callback;
884884

885-
binding.symlink(preprocessSymlinkDestination(destination, type, path),
885+
binding.symlink(preprocessSymlinkDestination(target, type, path),
886886
pathModule._makeLong(path),
887887
type,
888888
req);
889889
};
890890

891-
fs.symlinkSync = function(destination, path, type) {
891+
fs.symlinkSync = function(target, path, type) {
892892
type = (typeof type === 'string' ? type : null);
893893

894-
nullCheck(destination);
894+
nullCheck(target);
895895
nullCheck(path);
896896

897-
return binding.symlink(preprocessSymlinkDestination(destination, type, path),
897+
return binding.symlink(preprocessSymlinkDestination(target, type, path),
898898
pathModule._makeLong(path),
899899
type);
900900
};
Collapse file

‎src/node_file.cc‎

Copy file name to clipboardExpand all lines: src/node_file.cc
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,15 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {
580580

581581
int len = args.Length();
582582
if (len < 1)
583-
return TYPE_ERROR("dest path required");
583+
return TYPE_ERROR("target path required");
584584
if (len < 2)
585585
return TYPE_ERROR("src path required");
586586
if (!args[0]->IsString())
587-
return TYPE_ERROR("dest path must be a string");
587+
return TYPE_ERROR("target path must be a string");
588588
if (!args[1]->IsString())
589589
return TYPE_ERROR("src path must be a string");
590590

591-
node::Utf8Value dest(env->isolate(), args[0]);
591+
node::Utf8Value target(env->isolate(), args[0]);
592592
node::Utf8Value path(env->isolate(), args[1]);
593593
int flags = 0;
594594

@@ -604,9 +604,9 @@ static void Symlink(const FunctionCallbackInfo<Value>& args) {
604604
}
605605

606606
if (args[3]->IsObject()) {
607-
ASYNC_DEST_CALL(symlink, args[3], *path, *dest, *path, flags)
607+
ASYNC_DEST_CALL(symlink, args[3], *path, *target, *path, flags)
608608
} else {
609-
SYNC_DEST_CALL(symlink, *dest, *path, *dest, *path, flags)
609+
SYNC_DEST_CALL(symlink, *target, *path, *target, *path, flags)
610610
}
611611
}
612612

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.