You must read the file. The following example is based on this demo from HTML5Rocks (it catches all errors, you can filter various types of errors ):
var errorHandler = function() { // File is not readable or does not exist! }; fs.root.getFile('log.txt', {}, function(fileEntry) { fileEntry.file(function(file) { var reader = new FileReader(); reader.onloadend = function() { // The file exists and is readable }; reader.readAsText(file); }, errorHandler); }, errorHandler);
The synchronous method is available only to web workers due to their blocking nature. Error handling is slightly different .
Rob w source share