MCPcopy Create free account
hub / github.com/vercel/vercel / statIfExists

Function statIfExists

packages/cli-exec/src/fsutils.ts:52–64  ·  view source on GitHub ↗
(
  filePath: string
)

Source from the content-addressed store, hash-verified

50 * Reads stat metadata while distinguishing absent paths from inspection errors.
51 */
52export async function statIfExists(
53 filePath: string
54): Promise<MaybeStatsResult> {
55 try {
56 return { stats: await stat(filePath) };
57 } catch (error) {
58 if (isMissingPathError(error)) {
59 return { missing: true };
60 }
61
62 return { reason: `could not inspect: ${getErrorMessage(error)}` };
63 }
64}
65
66/**
67 * Returns whether a resolved executable should be invoked through Node.

Callers 2

Calls 3

isMissingPathErrorFunction · 0.90
getErrorMessageFunction · 0.90
statFunction · 0.85

Tested by

no test coverage detected