本文整理汇总了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}'.`);
});
}
示例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;
});
}
示例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;
}
示例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);
}
};
});
});
示例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}.`);
});
}