symlink()
创建一个流(stream),用于连接 Vinyl 对象到文件系统。
用法
const { src, symlink } = require('gulp');
function link() {
return src('input/*.js')
.pipe(symlink('output/'));
}
exports.link = link;
函数原型
symlink(directory, [options])
参数
参数 | 类型 | 描述 | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
directory (required) | string function | The path of the output directory where symbolic links will be created. If a function is used, the function will be called with each Vinyl object and must return a string directory path. | ||||||||||||||||||||||||
options | object | Detailed in 返回值 A stream that can be used in the middle or at the end of a pipeline to create symbolic links on the file system. Whenever a Vinyl object is passed through the stream, it creates a symbolic link to the original file on the file system at the given directory. Whenever a symbolic link is created on the file system, the Vinyl object will be modified.
Note: On Windows, directory links are created using junctions by default. The 可能出现的错误When When When 选项对于接受函数的选项,传递的函数将与每个 Vinyl 对象一起调用,并且必须返回另一个列出类型的值。
|