Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Function to check if a file exists using a HEAD request
- function fileExists(url) {
- try {
- const response = fetch(url, { method: 'HEAD' });
- return response.ok;
- } catch (error) {
- // console.error(`Error checking file existence: ${error}`);
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement