Is it possible to save files in the cache directory from Phonegap?

Is it possible to save files in cache directory from phonegap?

thanks

zipi

You can do something like this. Juste replace cordova.file.dataDirectory with cordova.file.cacheDirectory (I think that’s the right name)

window.resolveLocalFileSystemURL(
    cordova.file.dataDirectory,
    function gotDir(dir) {
        console.log("Data directory located");
        dir.getFile(sessionID + ".html", {create:true},
                    function(file) {
                        console.log("got the file", file);
                        file.createWriter(this.gotFileWriter,
                                          function fail() {
                                              console.log("Unable to create the writer");
                                         });
                });
    }
    function fail()
        console.log("Unable to locate the cache");
});
Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 移动开发 » Is it possible to save files in the cache directory from Phonegap?

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录