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

Function isFileReadable

packages/vite/src/node/utils.ts:569–582  ·  view source on GitHub ↗
(filename: string)

Source from the content-addressed store, hash-verified

567}
568
569export function isFileReadable(filename: string): boolean {
570 if (!tryStatSync(filename)) {
571 return false
572 }
573
574 try {
575 // Check if current process has read permission to the file
576 fs.accessSync(filename, fs.constants.R_OK)
577
578 return true
579 } catch {
580 return false
581 }
582}
583
584const splitFirstDirRE = /(.+?)[\\/](.+)/
585

Callers 4

hasWorkspacePackageJSONFunction · 0.90
hasWorkspaceDenoJSONFunction · 0.90
checkLoadingAccessFunction · 0.90
utils.spec.tsFile · 0.90

Calls 1

tryStatSyncFunction · 0.85

Tested by

no test coverage detected