Instructions for the fs.link method in node.js
- 2020-05-05 10:55:28
- OfStack
method description:
Create hard links.
syntax:
fs.link(srcpath, dstpath, [callback(err)])
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 to the source directory or file
dstpath it is the path to the converted directory, which defaults to the current working directory
callback callback, passing an err exception parameter
source code:
fs.link = function(srcpath, dstpath, callback) {
callback = makeCallback(callback);
if (!nullCheck(srcpath, callback)) return;
if (!nullCheck(dstpath, callback)) return;
binding.link(pathModule._makeLong(srcpath),
pathModule._makeLong(dstpath),
callback);
};