Symlink
[<Interface>]
type Symlink =
abstract member Invoke (target: PathLike, path: PathLike, callback: NoParamCallback) : unit
abstract member Invoke (target: PathLike, path: PathLike, type: Type option, callback: NoParamCallback) : unit
abstract member __promisify__ (target: PathLike, path: PathLike, ?type: string) : Promise<unit>| Assembly | Xantham.Fable.Node |
Methods
abstract member Invoke (target: PathLike, path: PathLike, callback: NoParamCallback) : unit
abstract member Invoke (target: PathLike, path: PathLike, callback: NoParamCallback) : unitCreates the link called path pointing to target. No arguments other than a possible exception are given to the completion callback.
See the POSIX symlink(2) documentation for more details.
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 a string, Node.js 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', thetarget argument will automatically be normalized to absolute path. Junction points on NTFS volumes can only point to directories.
Relative targets are relative to the link's parent directory.
import { symlink } from 'node:fs';
symlink('./mew', './mewtwo', callback);
The above example creates a symbolic link mewtwo which points to mew in the same directory:
$ tree .
.
├── mew
└── mewtwo -> ./mew
Asynchronous symlink(2) - Create a new symbolic link to an existing file.
| Parameter | |
|---|---|
target | A path to an existing file. If a URL is provided, it must use the file: protocol. |
path | A path to the new symlink. If a URL is provided, it must use the file: protocol. |
abstract member Invoke (target: PathLike, path: PathLike, type: Type option, callback: NoParamCallback) : unit
abstract member Invoke (target: PathLike, path: PathLike, type: Type option, callback: NoParamCallback) : unitCreates the link called path pointing to target. No arguments other than a possible exception are given to the completion callback.
See the POSIX symlink(2) documentation for more details.
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 a string, Node.js 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', thetarget argument will automatically be normalized to absolute path. Junction points on NTFS volumes can only point to directories.
Relative targets are relative to the link's parent directory.
import { symlink } from 'node:fs';
symlink('./mew', './mewtwo', callback);
The above example creates a symbolic link mewtwo which points to mew in the same directory:
$ tree .
.
├── mew
└── mewtwo -> ./mew
Asynchronous symlink(2) - Create a new symbolic link to an existing file.
@since v0.1.31
| Parameter | |
|---|---|
target | A path to an existing file. If a URL is provided, it must use the file: protocol. |
path | A path to the new symlink. If a URL is provided, it must use the file: protocol. |
abstract member __promisify__ (target: PathLike, path: PathLike, ?type: string) : Promise<unit>
abstract member __promisify__ (target: PathLike, path: PathLike, ?type: string) : Promise<unit>Asynchronous symlink(2) - Create a new symbolic link to an existing file.
| Parameter | |
|---|---|
target | A path to an existing file. If a URL is provided, it must use the file: protocol. |
path | A path to the new symlink. If a URL is provided, it must use the file: protocol. |
type | May be set to 'dir', 'file', or 'junction' (default is 'file') and is only available on Windows (ignored on other platforms). When using 'junction', the target argument will automatically be normalized to an absolute path. |