title: How to save multiple files in a chrome app
body: <p>I am trying to save multiple files to a directory - in one operation. If I correctly understand the <a href="http://developer.chrome.com/apps/fileSystem.html">chrome fileSystem api documentation</a> this should be possible when I use the <strong>openDirectory</strong> option for <em>chrome.fileSystem.chooseEntry</em>. Is that even allowed?<br>
  However, the documentation is very minimalistic and I also did not find any examples via google.</p>
  
  <p><strong>More background:</strong><br>
  I have the proper permissions to access a directory and also have write permissions:</p>
  
  <pre><code>/*you need chrome &gt;= Version 31.x [currently chrome beta]*/
  "permissions": [
      {"fileSystem": ["write", "directory"]}, "storage", 
  ]
  </code></pre>
  
  <p>Then you are left with <strong>chrome.fileSystem.chooseEntry(object options, function callback)</strong> and <strong>chrome.fileSystem.getWritableEntry(entry entry, function callback)</strong>, but I did not figure out if these functions are even what I want.</p>
  
  <p>Here is how a <em>single file</em> can be saved to the file system:</p>
  
  <pre><code>chrome.fileSystem.chooseEntry({type:"saveFile", suggestedName:"image.jpg"}, 
      function(entry, array){
          save(entry, blob); /*the blob was provided earlier*/
      }
  );
  
  function save(fileEntry, content) {
      fileEntry.createWriter(function(fileWriter) {
          fileWriter.onwriteend = function(e) {
              fileWriter.onwriteend = null;
              fileWriter.truncate(content.size);
          };
          fileWriter.onerror = function(e) {
              console.log('Write failed: ' + e.toString());
          };
          var blob = new Blob([content], {'type': 'image/jpeg'});
          fileWriter.write(blob);
      }, errorHandler);
  }
  </code></pre>
  
  <p>But how can I save multiple files when I use <strong>chrome.fileSystem.chooseEntry({type:"openDirectory",..}</strong> or does <strong>openDirectory</strong> only grant me read-rights?</p>