MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / exists

Function exists

javascript/selenium-webdriver/io/index.js:138–147  ·  view source on GitHub ↗

* Tests if a file path exists. * @param {string} aPath The path to test. * @return {!Promise } A promise for whether the file exists.

(aPath)

Source from the content-addressed store, hash-verified

136 * @return {!Promise<boolean>} A promise for whether the file exists.
137 */
138function exists(aPath) {
139 return new Promise(function (fulfill, reject) {
140 let type = typeof aPath
141 if (type !== 'string') {
142 reject(TypeError(`expected string path, but got ${type}`))
143 } else {
144 fulfill(fs.existsSync(aPath))
145 }
146 })
147}
148
149/**
150 * Calls `stat(2)`.

Callers

nothing calls this directly

Calls 1

rejectFunction · 0.85

Tested by

no test coverage detected