title: Chrome: Unable to use FileSystem API due to the error "Uncaught ReferenceError: FileError is not defined"
body: <p>I am working on a Chrome Extension which will read file from the drive. For testing purpose I am using the code given online to test FileSystem APIs. Upon running I get error</p>
  
  <p><code>Uncaught ReferenceError: FileError is not defined</code></p>
  
  <p>I am on OSX. I even added the flag by doing like below but no difference:</p>
  
  <p><code>open /Applications/Google\ Chrome.app --args --allow-file-access-from-files</code></p>
  
  <p>What is wrong being done by me? The code given below:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;meta charset=utf-8 /&gt;
      &lt;title&gt;Chrome File API tester&lt;/title&gt;
  
      &lt;script&gt;
          window.requestFileSystem  = window.requestFileSystem || window.webkitRequestFileSystem;
  
          // Handle errors
          function errorHandler(e) {
              var msg = '';
  
              switch (e.code) {
                  case FileError.QUOTA_EXCEEDED_ERR:
                      msg = 'QUOTA_EXCEEDED_ERR';
                      break;
                  case FileError.NOT_FOUND_ERR:
                      msg = 'NOT_FOUND_ERR';
                      break;
                  case FileError.SECURITY_ERR:
                      msg = 'SECURITY_ERR';
                      break;
                  case FileError.INVALID_MODIFICATION_ERR:
                      msg = 'INVALID_MODIFICATION_ERR';
                      break;
                  case FileError.INVALID_STATE_ERR:
                      msg = 'INVALID_STATE_ERR';
                      break;
                  default:
                      msg = 'Unknown Error';
                      break;
              };
              console.log('Error: ' + msg);
          }
  
          // Init and write some data to a file
          function onInitFs(fs) {
              fs.root.getFile('log-f-api.txt', {create: true}, function(fileEntry) {
  
                  fileEntry.isFile === true;
                  fileEntry.name == 'log-f-api.txt';
                  fileEntry.fullPath == '/log-f-api.txt';
                  // Create a FileWriter object for our FileEntry (log.txt).
                  fileEntry.createWriter(function(fileWriter) {
  
                      fileWriter.onwriteend = function(e) {
                          console.log('Write completed.');
                      };
  
                      fileWriter.onerror = function(e) {
                          console.log('Write failed: ' + e);
                      };
  
                      // Create a new Blob and write it to log.txt.
                      if (!window.BlobBuilder &amp;&amp; window.WebKitBlobBuilder)
                          window.BlobBuilder = window.WebKitBlobBuilder; // in Chrome 12.
                      var bb = new BlobBuilder();
                      bb.append("some stuff");
                      console.log("bb size:"+bb.size);
                      bb.append('put some nice text in our file....');
                      var ourData = bb.getBlob('text/plain');
                      fileWriter.write(ourData);
                  }, errorHandler);
              }, errorHandler);
          }
  
          // start the party
          $(function() {
              document.getElementById('hello').innerHTML = 'start the tests';
              window.requestFileSystem(window.PERSISTENT, 5*1024*1024, onInitFs,errorHandler);
          });
  
      &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;p id="hello"&gt;Tester FIle API&lt;/p&gt;
  
  &lt;h4&gt;Other links&lt;/h4&gt;
  &lt;ul&gt;
      &lt;li&gt;http://code.google.com/chrome/extensions/trunk/fileBrowserHandler.html#event-onExecute&lt;/li&gt;
      &lt;li&gt;http://html5rocks.com&lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>