Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: clarify fs.link and fs.linkSync arguments #9145

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1034,25 +1034,25 @@ deprecated: v0.4.7

Synchronous lchown(2). Returns `undefined`.

## fs.link(srcpath, dstpath, callback)
## fs.link(existingPath, newPath, callback)
<!-- YAML
added: v0.1.31
-->

* `srcpath` {String | Buffer}
* `dstpath` {String | Buffer}
* `existingPath` {String | Buffer}
* `newPath` {String | Buffer}
* `callback` {Function}

Asynchronous link(2). No arguments other than a possible exception are given to
the completion callback.

## fs.linkSync(srcpath, dstpath)
## fs.linkSync(existingPath, newPath)
<!-- YAML
added: v0.1.31
-->

* `srcpath` {String | Buffer}
* `dstpath` {String | Buffer}
* `existingPath` {String | Buffer}
* `newPath` {String | Buffer}

Synchronous link(2). Returns `undefined`.

Expand Down
20 changes: 10 additions & 10 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,24 +955,24 @@ fs.symlinkSync = function(target, path, type) {
type);
};

fs.link = function(srcpath, dstpath, callback) {
fs.link = function(existingPath, newPath, callback) {
callback = makeCallback(callback);
if (!nullCheck(srcpath, callback)) return;
if (!nullCheck(dstpath, callback)) return;
if (!nullCheck(existingPath, callback)) return;
if (!nullCheck(newPath, callback)) return;

var req = new FSReqWrap();
req.oncomplete = callback;

binding.link(pathModule._makeLong(srcpath),
pathModule._makeLong(dstpath),
binding.link(pathModule._makeLong(existingPath),
pathModule._makeLong(newPath),
req);
};

fs.linkSync = function(srcpath, dstpath) {
nullCheck(srcpath);
nullCheck(dstpath);
return binding.link(pathModule._makeLong(srcpath),
pathModule._makeLong(dstpath));
fs.linkSync = function(existingPath, newPath) {
nullCheck(existingPath);
nullCheck(newPath);
return binding.link(pathModule._makeLong(existingPath),
pathModule._makeLong(newPath));
};

fs.unlink = function(path, callback) {
Expand Down