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

Function readFileTextIfExists

packages/python-analysis/src/util/fs.ts:27–37  ·  view source on GitHub ↗
(
  file: Path,
  encoding: BufferEncoding = 'utf8'
)

Source from the content-addressed store, hash-verified

25}
26
27export async function readFileTextIfExists(
28 file: Path,
29 encoding: BufferEncoding = 'utf8'
30): Promise<string | null> {
31 const data = await readFileIfExists(file);
32 if (data == null) {
33 return null;
34 } else {
35 return data.toString(encoding);
36 }
37}
38
39export function normalizePath(p: Path): AbsPath {
40 let np = path.normalize(p);

Callers 4

maybeLoadLockFileFunction · 0.90
maybeLoadRequirementsTxtFunction · 0.90
maybeLoadPythonRequestFunction · 0.90
readConfigIfExistsFunction · 0.90

Calls 2

readFileIfExistsFunction · 0.85
toStringMethod · 0.45

Tested by

no test coverage detected