本文整理汇总了TypeScript中azure-pipelines-task-lib/task.stats函数的典型用法代码示例。如果您正苦于以下问题:TypeScript stats函数的具体用法?TypeScript stats怎么用?TypeScript stats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stats函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("downloads npm file as tgz and extracts it", (done: MochaDone) => {
this.timeout(1000);
let tp: string = path.join(__dirname, "L0DownloadNpmPackage.js");
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
tr.run();
assert.equal(tl.ls(null, [tempDir]).length, 1, "should have only 1 file.");
const zipPath = path.join(tempDir, "singlePackageName.tgz");
const zipStats = tl.stats(zipPath);
assert(zipStats && zipStats.isFile(), "tgz file should be downloaded");
var extractedFilePath = path.join(destinationDir, "npmFile");
const fileStats = tl.stats(extractedFilePath);
assert(fileStats && fileStats.isFile(), "tgz file should be extracted");
assert(tr.stderr.length === 0, "should not have written to stderr");
assert(tr.succeeded, "task should have succeeded");
done();
});
示例2: pathExistsAsDirectory
export function pathExistsAsDirectory(path: string) {
return tl.exist(path) && tl.stats(path).isDirectory();
}
示例3: pathExistsAsFile
export function pathExistsAsFile(path: string) {
return tl.exist(path) && tl.stats(path).isFile();
}
示例4: Error
filesList.forEach((packageFile) => {
if (!tl.stats(packageFile).isFile()) {
throw new Error(tl.loc("Error_PushNotARegularFile", packageFile));
}
});
示例5:
filesList = filesList.filter((x) => tl.stats(x).isFile() || tl.stats(x).isDirectory());