本文整理汇总了TypeScript中vs/base/node/extfs.readdir函数的典型用法代码示例。如果您正苦于以下问题:TypeScript readdir函数的具体用法?TypeScript readdir怎么用?TypeScript readdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readdir函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: nodeJSTraversal
private nodeJSTraversal(folderQuery: IFolderSearch, onResult: (result: IRawFileMatch) => void, onMessage: (message: IProgress) => void, done: (err?: Error) => void): void {
this.directoriesWalked++;
extfs.readdir(folderQuery.folder, (error: Error, files: string[]) => {
if (error || this.isCanceled || this.isLimitHit) {
return done();
}
// Support relative paths to files from a root resource (ignores excludes)
return this.checkFilePatternRelativeMatch(folderQuery.folder, (match, size) => {
if (this.isCanceled || this.isLimitHit) {
return done();
}
// Report result from file pattern if matching
if (match) {
this.resultCount++;
onResult({
base: folderQuery.folder,
relativePath: this.filePattern,
basename: path.basename(this.filePattern),
size
});
}
return this.doWalk(folderQuery, '', files, onResult, done);
});
});
}
示例2: nodeJSTraversal
private nodeJSTraversal(folderQuery: IFolderQuery, onResult: (result: IRawFileMatch) => void, onMessage: (message: IProgress) => void, done: (err?: Error) => void): void {
this.directoriesWalked++;
extfs.readdir(folderQuery.folder.fsPath, (error: Error, files: string[]) => {
if (error || this.isCanceled || this.isLimitHit) {
return done();
}
if (this.isCanceled || this.isLimitHit) {
return done();
}
return this.doWalk(folderQuery, '', files, onResult, done);
});
}
示例3: clb
return this.realPathIfNeeded(currentAbsolutePath, lstat, (error, realpath) => {
if (error || this.isCanceled || this.isLimitHit) {
return clb(null, undefined);
}
if (this.walkedPaths[realpath]) {
return clb(null, undefined); // escape when there are cycles (can happen with symlinks)
}
this.walkedPaths[realpath] = true; // remember as walked
// Continue walking
return extfs.readdir(currentAbsolutePath, (error: Error, children: string[]): void => {
if (error || this.isCanceled || this.isLimitHit) {
return clb(null, undefined);
}
this.doWalk(folderQuery, currentRelativePath, children, onResult, err => clb(err, undefined));
});
});