當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。