Can you please tell me how to check if a file exists or not in javascript? Actually I'm using Fileserver.js
. When run, it creates a file named "a.txt"
. When I run it again, it creates: a.txt(1)
[a.txt(2)
...]. I want to check if the file exists so it can ask the user if they want to overwrite the file (if the file exists).
$(function(){
var blob = new Blob([ "iiiiiii" ], {
type : "text/plain;charset=utf-8"
});
saveAs(blob, 'a,txt');
});
I googled to find it, but it's giving false every time.
http://jsfiddle.net/zrnQR/4/