当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript extfs.readdir函数代码示例

本文整理汇总了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);
			});
		});
	}
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:28,代码来源:fileSearch.ts

示例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);
		});
	}
开发者ID:KTXSoftware,项目名称:KodeStudio,代码行数:14,代码来源:fileSearch.ts

示例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));
							});
						});
开发者ID:KTXSoftware,项目名称:KodeStudio,代码行数:20,代码来源:fileSearch.ts


注:本文中的vs/base/node/extfs.readdir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。