Angshu Guha Angshu Guha - 10 months ago 43
AngularJS Question

Checking existence of a large file served on localhost

I have a file served on a localhost URL like this:


Now I have to check the existence of file using JavaScript in my Chrome App. I tried using an AJAX call, but that process is responding extremely slowly as the file size is large.

I just need to check the existence of file — is there a smart way to check that? I'm also new to
and not getting the use of it.


Maybe you can use a HEAD request instead of a regular GET? That would return all the server headers along with the response status, and without any data beeing sent from the server. If response status is 200 - your file is present on the server, if it's 404 - it is not.