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

17 lines
256 B
TypeScript
Raw Normal View History

2021-01-21 21:06:52 +00:00
'use strict';
2024-07-22 14:53:37 +02:00
import fs from 'fs';
2016-06-20 00:22:29 +02:00
const check = (path:string) => {
const existsSync = fs.statSync || fs.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
2024-07-22 14:53:37 +02:00
export default check