title: How to cache audio file for Service workers?
body: <p>I'm writing a web application in HTML/Javacript that records audio and uploads it to a server. Now, I would like to put it also in cache so it's available to service.workers for an offline scenario. What's the best way to do this?</p>
  
  <p>Program flow:</p>
  
  <ol>
  <li>Record audio </li>
  <li>Capture data in a Blob</li>
  <li>Save data on server</li>
  <li>Listen to recorded stuff</li>
  </ol>
  
  <p>If you are online, of course, all works well.<br>
  I would like to have the file locally available for listening before it is remotely saved, and backup it on server ASAP.<br>
  This is my routine:</p>
  
  <pre><code>function mettiincache(name, myBlob) {  
      var resp = new Response(myBlob)
      var CACHE_NAME = 'window-cache-v1';
      caches.open(CACHE_NAME).then(function (cache) {
      cache.put(name, resp)
      }).catch(function (error) {
      ChromeSamples.setStatus(error);
      });
  }
  </code></pre>
  
  <p>When I look in Application/cache storage using Chrome DevTools, I find an entry with the correct path/name and content-Type, but with a content-Length of 0 bytes</p>