Chrome Apps : How to save blob content to fileSystem in the background?

只谈情不闲聊 提交于 2019-11-29 10:57:53

Chrome Application's sandbox storage doesn't allow files to be stored in root directory (i.e. / )

Modify the code to save it in a specific sub-directory under it. For example -

fileSystem.writeBlob("/new"+response.name, response).then(function() {
             console.log("file saved");
          }, function(err) {
              console.log(err);
          });

This would successfully save the file under /new/ directory.

To expand on this, here is a full example app on how to download a file and save the blob and display it back to the user.

https://github.com/PierBover/chrome-os-app-download-example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!