MCPcopy Index your code
hub / github.com/isomorphic-git/isomorphic-git / exists

Method exists

src/models/FileSystem.js:92–108  ·  view source on GitHub ↗

* Return true if a file exists, false if it doesn't exist. * Rethrows errors that aren't related to file existence. * * @param {string} filepath - The path to the file. * @param {Object} [options] - Additional options. * @returns {Promise } - `true` if the file exists, `false`

(filepath, options = {})

Source from the content-addressed store, hash-verified

90 * @returns {Promise<boolean>} - `true` if the file exists, `false` otherwise.
91 */
92 async exists(filepath, options = {}) {
93 try {
94 await this._stat(filepath)
95 return true
96 } catch (err) {
97 if (
98 err.code === 'ENOENT' ||
99 err.code === 'ENOTDIR' ||
100 (err.code || '').includes('ENS')
101 ) {
102 return false
103 } else {
104 console.log('Unhandled error in "FileSystem.exists()" function', err)
105 throw err
106 }
107 }
108 }
109
110 /**
111 * Return the contents of a file if it exists, otherwise returns null.

Callers 15

stashFunction · 0.95
iterateFunction · 0.45
applyTreeChangesFunction · 0.45
_initFunction · 0.45
_branchFunction · 0.45
_annotatedTagFunction · 0.45
_deleteBranchFunction · 0.45
_renameBranchFunction · 0.45
_findRootFunction · 0.45
_stashDropFunction · 0.45
_stashClearFunction · 0.45
hasObjectLooseFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected