From 5618ae2f0364d602f816b2c290742a9dd4ecab99 Mon Sep 17 00:00:00 2001 From: "Kyle E. Mitchell" Date: Mon, 17 Oct 2016 20:04:50 -0700 Subject: [PATCH 1/2] doc: clarify fs.link and fs.linkSync arguments Clarifies documentation by replacing the argument names `srcpath` and `dstpath` with more descriptive `existingPath` and `newPath`, reflecting how POSIX describes `link()`. --- doc/api/fs.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index cac42e97fab44d..a9e1e3fd4bd1a6 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1034,25 +1034,25 @@ deprecated: v0.4.7 Synchronous lchown(2). Returns `undefined`. -## fs.link(srcpath, dstpath, callback) +## fs.link(existingPath, newPath, callback) -* `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) -* `srcpath` {String | Buffer} -* `dstpath` {String | Buffer} +* `existingPath` {String | Buffer} +* `newPath` {String | Buffer} Synchronous link(2). Returns `undefined`. From ecacc6182314a6eb6c4be3e25f4d7b55b6c0edb0 Mon Sep 17 00:00:00 2001 From: "Kyle E. Mitchell" Date: Wed, 19 Oct 2016 13:42:34 -0700 Subject: [PATCH 2/2] fs: clarify fs.link and fs.linkSync arguments Updates the argument names `srcpath` and `dstpath` to match the more descriptive `existingPath` and `newPath` in the documentation. --- lib/fs.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 56e70d2f472100..37a14c7fd51c17 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -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) {