本文整理匯總了TypeScript中fs-promise.copy函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript copy函數的具體用法?TypeScript copy怎麽用?TypeScript copy使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了copy函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
async function test() {
await fs.copy(src, dst);
await fs.emptyDir(dir);
await fs.emptydir(dir);
await fs.ensureFile(path);
await fs.createFile(path);
await fs.ensureDir(dir);
await fs.ensureLink(src, dst);
await fs.createLink(src, dst);
await fs.ensureSymlink(src, dst);
await fs.ensureSymlink(src, dst, "dir");
await fs.ensureSymlink(src, dst, "file");
await fs.ensureSymlink(src, dst, "junction");
await fs.createSymlink(src, dst, "dir");
await fs.mkdirs(dir);
await fs.mkdirp(dir);
await fs.move(src, dst);
await fs.outputFile(path, "test");
await fs.outputFile(path, "test", writeOptions);
await fs.outputFile(path, new Buffer([1,2]));
await fs.outputFile(path, new Buffer([1,2]), writeOptions);
await fs.outputJson(path, data);
await fs.outputJson(path, data, writeJsonOptions);
await fs.outputJSON(path, data, writeJsonOptions);
let json = await fs.readJson(path);
json = await fs.readJson(path, readJsonOptions);
json = await fs.readJSON(path, readJsonOptions);
await fs.remove(path);
let dirs: string[] = await fs.walk(dir);
await fs.writeJson(path, data);
await fs.writeJson(path, data, writeJsonOptions);
await fs.writeJSON(path, data, writeJsonOptions);
return dirs;
}
示例2: copyFilesToOutput
export async function copyFilesToOutput(env: Environment): Promise<void> {
let filesPath = env.resolvePath("files");
let outputPath = env.resolvePath("output");
try {
await fs.access(filesPath, fs.R_OK);
await fs.copy(filesPath, outputPath, {
clobber: false,
preserveTimestamps: true
});
}
catch (err) {
//console.log("No source files to copy.");
}
}