本文整理汇总了TypeScript中symlink-or-copy.sync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript sync函数的具体用法?TypeScript sync怎么用?TypeScript sync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sync函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: rebuild
rebuild() {
fs.rmdirSync(this.outputPath);
// TODO: investigate if we can use rename the directory instead to improve performance on
// Windows
symlinkOrCopy.sync(this.inputPath, this.outputPath);
}
示例2:
import * as symlinkOrCopy from 'symlink-or-copy';
symlinkOrCopy.sync('src_dir/some_file.txt', 'dest_dir/some_file.txt');
symlinkOrCopy.canSymlink; // $ExpectType boolean
symlinkOrCopy.canSymlinkDirectory; // $ExpectType boolean
symlinkOrCopy.canSymlinkFile; // $ExpectType boolean
示例3: symlinkOrReplaceSync
export function symlinkOrReplaceSync(srcPath: string, destDir: string, fileName: string): void {
const destPath = path.join(destDir, fileName);
if (fs.existsSync(destPath)) {
fs.unlinkSync(destPath);
}
mkdirpSync(destDir);
symlinkOrCopySync(srcPath, destPath);
}
示例4: Error
pathsToUpdate.forEach((changedFilePath) => {
var sourceFilePath = path.join(this.inputPath, changedFilePath);
var destFilePath = path.join(this.cachePath, path.basename(changedFilePath));
var destDirPath = path.dirname(destFilePath);
if (!fs.existsSync(destDirPath)) {
fse.mkdirpSync(destDirPath);
}
if (!fs.existsSync(destFilePath)) {
symlinkOrCopy(sourceFilePath, destFilePath);
} else {
throw new Error(`Duplicate file '${path.basename(changedFilePath)}' ` +
`found in path '${changedFilePath}'`);
}
});