PhoneGap will not let you read files outside of the [APP HASH]/Documents or [APP HASH]/tmp folders. Unless you can find a way to initialize your app with your data in one of these folders, you will have to get your data another way. I have found the below code to work. Basically it downloads the local file into your temp folder and gives you the file entry.
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, function(fs){
fs.root.getFile("temp", {create: true, exclusive: false},
function(entry){
fileTransfer.download(
Url, // the filesystem uri you mentioned
entry.fullPath,
function(entry) {
// do what you want with the entry here
console.log("download complete: " + entry.fullPath);
},
function(error) {
console.log("error source " + error.source);
console.log("error target " + error.target);
console.log("error code " + error.code);
},
false,
null
);
}, function(){
alert("file create error");
});
}, null);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…