Angshu Guha Angshu Guha - 1 year ago 82
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download