Function symlink

  • Creates 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 set, 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.

    Relative targets are relative to the link’s parent directory.

    import { symlink } from 'fs';

    symlink('./mew', './example/mewtwo', callback);

    The above example creates a symbolic link mewtwo in the example which points to mew in the same directory:

    $ tree example/
    example/
    ├── mew
    └── mewtwo -> ./mew

    Since

    v0.0.67

    Parameters

    Returns void

  • Asynchronous symlink(2) - Create a new symbolic link to an existing file.

    Parameters

    • target: PathLike

      A path to an existing file. If a URL is provided, it must use the file: protocol.

    • path: PathLike

      A path to the new symlink. If a URL is provided, it must use the file: protocol.

    • callback: VoidFunction

    Returns void

  • Creates 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 set, 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.

    Relative targets are relative to the link’s parent directory.

    import { symlink } from 'fs';

    symlink('./mew', './example/mewtwo', callback);

    The above example creates a symbolic link mewtwo in the example which points to mew in the same directory:

    $ tree example/
    example/
    ├── mew
    └── mewtwo -> ./mew

    Since

    v0.0.67

    Parameters

    Returns void

  • Asynchronous symlink(2) - Create a new symbolic link to an existing file.

    Parameters

    • target: PathLike

      A path to an existing file. If a URL is provided, it must use the file: protocol.

    • path: PathLike

      A path to the new symlink. If a URL is provided, it must use the file: protocol.

    • callback: VoidFunction

    Returns void

Generated using TypeDoc