MCPcopy Index your code
hub / github.com/SchemaStore/schemastore / exists

Function exists

cli.js:177–190  ·  view source on GitHub ↗

* @typedef {Object} DataFile * @property {Buffer} buffer * @property {string} text * @property {Record } json * @property {string} name * @property {string} path * * @typedef {Object} SchemaFile * @property {Buffer} buffer * @property {string} text * @property {JsonSch

(/** @type {string} */ filepath)

Source from the content-addressed store, hash-verified

175 */
176
177async function exists(/** @type {string} */ filepath) {
178 return fs
179 .stat(filepath)
180 .then(() => {
181 return true
182 })
183 .catch((/** @type {NodeJS.ErrnoException} */ err) => {
184 if (err instanceof Error && err.code === 'ENOENT') {
185 return false
186 } else {
187 throw err
188 }
189 })
190}
191
192async function readJsonFile(/** @type {string} */ filename) {
193 return JSON.parse(await fs.readFile(filename, 'utf-8'))

Callers 4

forEachFileFunction · 0.70
handleInputFunction · 0.70
onTestDirFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected