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
Closed
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
32 changes: 21 additions & 11 deletions 32 doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.