summaryrefslogtreecommitdiff
path: root/doc/api/fs.md
diff options
context:
space:
mode:
authorSimon A. Eugster <simon.eu@gmail.com>2019-09-25 14:58:10 +0200
committerRich Trott <rtrott@gmail.com>2019-09-30 11:44:19 -0700
commit2487f390307b28be8c2d1d137f483900937237eb (patch)
tree9b1b03f7cd0b523ccd60ea996bc82189216dc028 /doc/api/fs.md
parentf663b31cc2aecd585e73430504f3d7f5252851ca (diff)
downloadandroid-node-v8-2487f390307b28be8c2d1d137f483900937237eb.tar.gz
android-node-v8-2487f390307b28be8c2d1d137f483900937237eb.tar.bz2
android-node-v8-2487f390307b28be8c2d1d137f483900937237eb.zip
doc: clarify fs.symlink() usage
PR-URL: https://github.com/nodejs/node/pull/29700 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api/fs.md')
-rw-r--r--doc/api/fs.md32
1 files changed, 21 insertions, 11 deletions
diff --git a/doc/api/fs.md b/doc/api/fs.md
index 037792154b..d2081c43e9 100644
--- a/doc/api/fs.md
+++ b/doc/api/fs.md
@@ -3249,22 +3249,32 @@ changes:
* `callback` {Function}
* `err` {Error}
-Asynchronous symlink(2). No arguments other than a possible exception are given
-to the completion callback. The `type` argument is only available on Windows
-and ignored on other platforms. It can be set to `'dir'`, `'file'`, or
-`'junction'`. If the `type` argument is not set, Node will autodetect `target`
-type and use `'file'` or `'dir'`. If the `target` does not exist, `'file'` will
-be used. Windows junction points require the destination path to be absolute.
-When using `'junction'`, the `target` argument will automatically be normalized
-to absolute path.
+Asynchronous symlink(2) which creates the link called `path` pointing to
+`target`. No arguments other than a possible exception are given to the
+completion callback.
-Here is an example below:
+The `type` argument is only available on Windows and ignored on other platforms.
+It can be set to `'dir'`, `'file'`, or `'junction'`. If the `type` argument is
+not set, Node will autodetect `target` type and use `'file'` or `'dir'`. If the
+`target` does not exist, `'file'` will be used. Windows junction points require
+the destination path to be absolute. When using `'junction'`, the `target`
+argument will automatically be normalized to absolute path.
+
+Relative targets are relative to the link’s parent directory.
```js
-fs.symlink('./foo', './new-port', callback);
+fs.symlink('./mew', './example/mewtwo', callback);
```
-It creates a symbolic link named "new-port" that points to "foo".
+The above example creates a symbolic link `mewtwo` in the `example` which points
+to `mew` in the same directory:
+
+```bash
+$ tree example/
+example/
+├── mew
+└── mewtwo -> ./mew
+```
## fs.symlinkSync(target, path[, type])
<!-- YAML