Home > Web Front-end > JS Tutorial > body text

Instructions for using the fs.symlinkSync method in node.js_node.js

WBOY
Release: 2016-05-16 16:26:59
Original
1514 people have browsed it

Method description:

Synchronized version of symlink(). Used to create symbolic links.

Grammar:

Copy code The code is as follows:

fs.symlinkSync(srcpath, dstpath, [type])

Since this method belongs to the fs module, the fs module needs to be introduced before use (var fs= require(“fs”) )

Receive parameters:

srcpath is the path of the source directory or file

dstpath It is the path to store the converted directory. The default is the current working directory

type                                                                                 Default value: 'file', optional values ​​'dir', 'file', or 'junction', this item is only used on Windows (ignored on other platforms).

Note that the directory that Windows nodes need to convert is an absolute path. When using "junction", the target parameters will be automatically normalized to the absolute path.

Source code:

Copy code The code is as follows:

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);
};
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template