etherpad-lite/src/node/utils/path_exists.js

17 lines
276 B
JavaScript
Raw Normal View History

2021-01-21 21:06:52 +00:00
'use strict';
2020-11-23 13:24:19 -05:00
const fs = require('fs');
2016-06-20 00:22:29 +02:00
2021-01-21 21:06:52 +00:00
const check = (path) => {
2020-11-23 13:24:19 -05:00
const existsSync = fs.statSync || fs.existsSync || path.existsSync;
2016-06-20 00:22:29 +02:00
2020-11-23 13:24:19 -05:00
let result;
2016-06-20 00:22:29 +02:00
try {
result = existsSync(path);
} catch (e) {
result = false;
}
return result;
2020-11-23 13:24:19 -05:00
};
2016-06-20 00:22:29 +02:00
module.exports = check;