MCPcopy Create free account
hub / github.com/npm/cli / localFileExists

Function localFileExists

workspaces/libnpmexec/lib/file-exists.js:14–28  ·  view source on GitHub ↗
(dir, binName, root)

Source from the content-addressed store, hash-verified

12}
13
14const localFileExists = async (dir, binName, root) => {
15 for (const path of walkUp(dir)) {
16 const binDir = resolve(path, 'node_modules', '.bin')
17
18 if (await fileExists(resolve(binDir, binName))) {
19 return binDir
20 }
21
22 if (path.toLowerCase() === resolve(root).toLowerCase()) {
23 return false
24 }
25 }
26
27 return false
28}
29
30module.exports = {
31 fileExists,

Callers 2

execFunction · 0.85
file-exists.jsFile · 0.85

Calls 2

resolveFunction · 0.85
fileExistsFunction · 0.70

Tested by

no test coverage detected