MCPcopy
hub / github.com/vitejs/vite / readFileIfExists

Function readFileIfExists

packages/vite/src/node/http.ts:160–165  ·  view source on GitHub ↗
(value?: string | Buffer | any[])

Source from the content-addressed store, hash-verified

158}
159
160async function readFileIfExists(value?: string | Buffer | any[]) {
161 if (typeof value === 'string') {
162 return fsp.readFile(path.resolve(value)).catch(() => value)
163 }
164 return value
165}
166
167// Check if a port is available on wildcard addresses (0.0.0.0, ::)
168async function isPortAvailable(port: number): Promise<boolean> {

Callers 1

resolveHttpsConfigFunction · 0.85

Calls 1

resolveMethod · 0.65

Tested by

no test coverage detected