Instructions for the fs.symlinkSync method in node.js
- 2020-05-05 10:55:31
- OfStack
method description:
Synchronous version of symlink(). Used to create symbolic links.
syntax:
fs.symlinkSync(srcpath, dstpath, [type])
Since this method belongs to the fs module, it is necessary to introduce the fs module (var fs= require(" fs "))
before using itreceive parameters:
srcpath is the path of the source directory or file
dstpath it is the path to the converted directory, which defaults to the current working directory
The default value is: 'file', optional values' dir', 'file', or' junction', which is only used for Windows (ignored on other platforms).
Note that the directory to be converted from Windows node is the absolute path. When "junction" is used, the target parameter will be automatically normalized to the absolute path.
source code:
fs.symlinkSync = function(destination, path, type) {
type = (util.isString(type) ? type : null);
nullCheck(destination);
nullCheck(path);
return binding.symlink(preprocessSymlinkDestination(destination, type),
pathModule._makeLong(path),
type);
};