本文整理匯總了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}.`);
});
}