window.resolveLocalFileSystemURL vs window.requestFileSystem

tob*_*bbe 10 fileapi cordova

使用cordova文件插件下载文件时使用window.resolveLocalFileSystemURLvs有什么区别window.requestFileSystem?我找不到关于resolveLocalFileSystemURL的任何文档,但它工作正常,它更容易使用?

我应该在cordova应用程序中使用哪一个简单的CRUD操作?

(我用cordova 3.4.0-0.1.3)

我这样使用它:

function onResolveSuccess(fileEntry) {

            fileEntry.file(function(file) {
               var reader = new FileReader();

               reader.onloadend = function(evt) {
                    var _machines = JSON.parse(evt.target.result);  
                    machinesCache.setMachines(_machines.AllMainCategories);
               };

               reader.readAsText(file);
            }, errorHandler);

        };

        window.resolveLocalFileSystemURL("cdvfile://localhost/persistent/machinedata/machines.json", onResolveSuccess, errorHandler);
Run Code Online (Sandbox Code Playgroud)

the*_*rel 7

综观www/resolveLocalFileSystemURI.jswww/requestFileSystem.js该文件的插件回购,我会说,他们实际上是相同的.

resolveLocalFileSystemURL如果您想访问cordova.file.*(例如cordova.file.dataDirectory)大多数时间(如果不是总是)的位置,我建议使用,requestFileSystem如果您需要访问文件系统的根目录,请使用.