blob: 261acda39bc8993541039faa2090b03b8e87ae02 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
const fileExists = async (url) => {
const xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function (e) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
return true;
}
return false;
}
};
xhr.onerror = function (e) {
return false;
};
xhr.send(null);
};
export default fileExists;
|