本文整理匯總了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}'`);
}
});