本文整理汇总了TypeScript中ncp.ncp函数的典型用法代码示例。如果您正苦于以下问题:TypeScript ncp函数的具体用法?TypeScript ncp怎么用?TypeScript ncp使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ncp函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
async.eachSeries(links, function(link: string, cb2: (err?: any) => void): void {
try {
var dest = fs.readlinkSync(link);
if (dest.match(/^\/etc/)) {
ncp(path.join(grunt.config('build.scratch_dir'), dest), link, function(err?: any) {
if (err) {
// Some /etc symlinks are just broken. Hopefully not a big deal.
grunt.log.writeln('warning: broken symlink: ' + dest);
}
cb2(null);
});
} else {
var p = path.resolve(path.join(path.dirname(link), dest));
// copy in anything that links out of the JH dir
if (p.indexOf(dir_name) === -1) {
// XXX: this fails if two symlinks reference the same file
if (fs.statSync(p).isDirectory()) {
fs.unlinkSync(link);
}
ncp(p, link, function(err?: any) {
if (err) {
grunt.log.writeln('warning: broken symlink: ' + p);
}
cb2(null);
});
} else {
// Nothing to do.
cb2(null);
}
}
} catch (e) {
grunt.log.writeln('warning: broken symlink: ' + link);
cb2(null);
}
}, function(err: any): void {
示例2: function
function(resolve, reject){
ncp(source, destination, function(err){
if(err){
reject(err);
}
resolve();
})
});
示例3: resolve
checksum.file(dst, (dstErr, dstSum) => {
if (srcSum === dstSum) {
console.log(`[unchanged]:${filename}`);
return resolve(`${filename} unchanged`);
}
// copy on error or checksum diffs
ncp(src, dst, err => {
if (err) {
reject(`failed to copy octicon: ${filename}`);
} else {
console.log(`[icon]:${filename}`);
resolve(`${filename} copied`);
}
});
});
示例4: copySchematicsCore
export async function copySchematicsCore(config: Config) {
(ncp as any).limit = 1;
for (let pkg of util.getTopLevelPackages(config)) {
const packageJson = fs
.readFileSync(`${modulesDir}${pkg}/package.json`)
.toString('utf-8');
const pkgConfig = JSON.parse(packageJson);
if (pkgConfig.schematics || pkgConfig['ng-update'].migrations) {
ncp(
`${modulesDir}/schematics-core`,
`${modulesDir}/${pkg}/schematics-core`,
function(err: any) {
if (err) {
return console.error(err);
}
}
);
}
}
}
示例5: Promise
await new Promise((c, e) => ncp(logsDir, destLogsDir, err => err ? e(err) : c()));
示例6: ncp
return new Promise<string>((resolve) => {
ncp(data.src,data.dest,(err)=>{
if (err) console.log('Move failed', err);
resolve(JSON.stringify(err));
});
});
示例7: function
}, function(err: any): void {
ncp(JH, java_home, function(err2?: any): void {
err2 = err2 ? err2 : err;
cb(err2);
});
});
示例8: function
}, function(err){
ncp(JH, java_home, function(err2?: any) {
err2 = err2 ? err2 : err;
cb(err2);
});
});