本文整理汇总了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.");
}
}