Aplicaciones de Chrome: ¿Cómo guardar contenido de blob en FileSystem en segundo plano?

En Chrome Apps, estoy descargando un contenido de blob de un servidor usando JavaScript XHR (Angular $ http GET en particular, con el tipo de respuesta 'blob')

¿Cómo debo guardar esto en el sistema de archivos de la aplicación Chrome?

Actualmente utiliza un contenedor angular en la API del sistema de archivos HTML5https://github.com/maciel310/angular-filesystem

No quiero mostrarle al usuario una ventana emergente (por lo tanto, no puedo usarchrome.fileSystem. chooseEntry )

loschrome.fileSystem.requestFileSystem API solo es compatible con aplicaciones solo de kiosco. Por lo tanto, estoy usando HTML5 FileSystem API en lugar de Chrome.

Estoy usando el siguiente código para hacer que XHR busque blob.

 $http({
          url: SERVER_URL+"/someVideo.mp4",
          method: "GET",
          responseType: "blob"
      }).then(function(response) {
          console.log(response);
          fileSystem.writeBlob(response.name, response).then(function() {
             console.log("file saved");
          }, function(err) {
              console.log(err);
          });
      }, function (response) {

      });

Este es mi método writeBlob

writeBlob: function(fileName, blob, append) {
    append = (typeof append == 'undefined' ? false : append);

    var def = $q.defer();

    fsDefer.promise.then(function(fs) {

        fs.root.getFile(fileName, {create: true}, function(fileEntry) {

            fileEntry.createWriter(function(fileWriter) {
                if(append) {
                    fileWriter.seek(fileWriter.length);
                }

                var truncated = false;
                fileWriter.onwriteend = function(e) {
                    //truncate all data after current position
                    if (!truncated) {
                        truncated = true;
                        this.truncate(this.position);
                        return;
                    }
                    safeResolve(def, "");
                };

                fileWriter.onerror = function(e) {
                    safeReject(def, {text: 'Write failed', obj: e});
                };

                fileWriter.write(blob);

            }, function(e) {
                safeReject(def, {text: "Error creating file", obj: e});
            });

        }, function(e) {
            safeReject(def, {text: "Error getting file", obj: e});
        });

    }, function(err) {
        def.reject(err);
    });

    return def.promise;
},

Esta espectáculosSECURITY_ERR comoIt was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.

¿Cuál es la solución para esto?

He intentado usar--allow-file-access-from-files marca al iniciar la aplicación. No ayuda

Respuestas a la pregunta(2)

Su respuesta a la pregunta