diff options
Diffstat (limited to 'webAO/utils/fileExists.js')
| -rw-r--r-- | webAO/utils/fileExists.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/webAO/utils/fileExists.js b/webAO/utils/fileExists.js new file mode 100644 index 0000000..6d32a1e --- /dev/null +++ b/webAO/utils/fileExists.js @@ -0,0 +1,8 @@ +const fileExists = async (url) => { + const xhr = new XMLHttpRequest(); + xhr.open('HEAD', url, false); + xhr.send(); + + return xhr.status === 200; +}; +export default fileExists; |
