Method description:
Create a symbolic link.
grammar:
The code copy is as follows:
fs.symlink(srcpath, dstpath, [type], [callback(err)])
Since this method belongs to the FS module, it is necessary to introduce the FS module before use (var fs= require("fs") )
Receive parameters:
srcpath is the path to the source directory or file
dstpath It is the path to store the converted directory, and defaults to the current working directory
type default value: 'file' , optional values 'dir', 'file', or 'junction' , which is only used for Windows (ignored on other platforms).
Note that the directory after Windows nodes needs to be converted is an absolute path. When using "junction", the target parameters will be automatically normalized to the absolute path.
callback callback, passing an exception parameter err
Source code:
The code copy is as follows:
fs.symlink = function(destination, path, type_, callback) {
var type = (util.isString(type_) ? type_ : null);
var callback = makeCallback(arguments[arguments.length - 1]);
if (!nullCheck(destination, callback)) return;
if (!nullCheck(path, callback)) return;
binding.symlink(preprocessSymlinkDestination(destination, type),
pathModule._makeLong(path),
type,
callback);
};