當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript fs-extra-promise.lstatAsync函數代碼示例

本文整理匯總了TypeScript中fs-extra-promise.lstatAsync函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript lstatAsync函數的具體用法?TypeScript lstatAsync怎麽用?TypeScript lstatAsync使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了lstatAsync函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getLaunchFilePath

function getLaunchFilePath(filePathOrFolder: string): Promise<string> {
    return fs.lstatAsync(filePathOrFolder).then(stats => {
        // If a file path was passed, assume its the launch file.
        if (stats.isFile()) {
            return filePathOrFolder;
        }

        // Otherwise, search the specified folder.
        let candidate: string;
        
        candidate = path.join(filePathOrFolder, runFileName);
        if (fs.existsSync(candidate)) {
            return candidate;
        }
        
        candidate = path.join(filePathOrFolder, omnisharpFileName);
        if (fs.existsSync(candidate)) {
            return candidate;
        }
        
        candidate = path.join(filePathOrFolder, omnisharpExeFileName);
        if (fs.existsSync(candidate)) {
            return candidate;
        }
        
        throw new Error(`Could not fnd launch file in ${filePathOrFolder}. Expected '${runFileName}', '${omnisharpFileName}', or '${omnisharpExeFileName}'.`);
    });
}
開發者ID:bertlacy,項目名稱:omnisharp-vscode,代碼行數:28,代碼來源:path.ts

示例2: findServerPath

    /**
     * Given a file path, returns the path to the SQL Tools service file.
     */
    public findServerPath(filePath: string, executableFiles: string[] = undefined): Promise<string> {
        return fs.lstatAsync(filePath).then(stats => {
            // If a file path was passed, assume its the launch file.
            if (stats.isFile()) {
                return filePath;
            }

            // Otherwise, search the specified folder.
            let candidate: string;

            if (executableFiles === undefined && this._config !== undefined) {
                executableFiles = this._config.getExecutableFiles();
            }
            if (executableFiles !== undefined) {
                executableFiles.forEach(element => {
                    let executableFile = path.join(filePath, element);
                    if (candidate === undefined && fs.existsSync(executableFile)) {
                        candidate = executableFile;
                        return candidate;
                    }
                });
            }


            return candidate;
        });
    }
開發者ID:AlexxNica,項目名稱:sqlopsstudio,代碼行數:30,代碼來源:server.ts

示例3: stat_file

export async function stat_file(file_name: string): Promise<any>{
	await lock.acquire();
	let out: any; 
	try{
		out = await fs.lstatAsync(file_name);
	}
	finally{
		lock.release();
	}
	return out;
}
開發者ID:BelaPlatform,項目名稱:Bela,代碼行數:11,代碼來源:FileManager.ts

示例4: runDotnetRestore

    return projects.map(project => {
        let projectDirectory = project.Path;

        return fs.lstatAsync(projectDirectory).then(stats => {
            if (stats.isFile()) {
                projectDirectory = path.dirname(projectDirectory);
            }

            return {
                label: `dotnet restore - (${project.Name || path.basename(project.Path)})`,
                description: projectDirectory,
                execute() {
                    return runDotnetRestore(projectDirectory);
                }
            };
        });
    });
開發者ID:bertlacy,項目名稱:omnisharp-vscode,代碼行數:17,代碼來源:commands.ts

示例5: findServerPath

export function findServerPath(filePath: string): Promise<string> {
    return fs.lstatAsync(filePath).then(stats => {
        // If a file path was passed, assume its the launch file.
        if (stats.isFile()) {
            return filePath;
        }

        // Otherwise, search the specified folder.
        let candidate: string;
        
        candidate = path.join(filePath, 'OmniSharp.exe');
        if (fs.existsSync(candidate)) {
            return candidate;
        }
        
        candidate = path.join(filePath, 'OmniSharp');
        if (fs.existsSync(candidate)) {
            return candidate;
        }
        
        throw new Error(`Could not find OmniSharp launch file in ${filePath}.`);
    });
}
開發者ID:Firaenix,項目名稱:omnisharp-vscode,代碼行數:23,代碼來源:omnisharp.ts


注:本文中的fs-extra-promise.lstatAsync函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。