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

Function readFileOrNull

packages/frameworks/src/read-config-file.ts:8–22  ·  view source on GitHub ↗
(file: string)

Source from the content-addressed store, hash-verified

6const { readFile } = promises;
7
8async function readFileOrNull(file: string) {
9 try {
10 const data = await readFile(file);
11 return data;
12 } catch (error: unknown) {
13 if (!isErrnoException(error)) {
14 throw error;
15 }
16 if (error.code !== 'ENOENT') {
17 throw error;
18 }
19 }
20
21 return null;
22}
23
24export async function readConfigFile<T>(
25 files: string | string[]

Callers 1

readConfigFileFunction · 0.70

Calls 2

isErrnoExceptionFunction · 0.90
readFileFunction · 0.50

Tested by

no test coverage detected