fs.symlink(target, path[, type], callback)


    创建名为 path 指向 target 的链接。 除了可能的异常之外,没有为完成回调提供任何参数。

    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 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', the target argument will automatically be normalized to absolute path.

    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