* @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)
| 175 | */ |
| 176 | |
| 177 | async 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 | |
| 192 | async function readJsonFile(/** @type {string} */ filename) { |
| 193 | return JSON.parse(await fs.readFile(filename, 'utf-8')) |
no outgoing calls
no test coverage detected