|
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
var gotFS= function (fileSystem) {
这个方法不会被执行
fileSystem.root.getFile(saveFileName, {create: true, exclusive: false}, gotFileEntry, fail);
};
var gotFileEntry= function (fileEntry) {
fileEntry.createWriter(gotFileWriter, fail);
};
var gotFileWriter= function (writer) {
writer.seek(0);
writer.write(Base64.decode(data));
};
var fail= function (error) {
alert(error.code);
};
var fileTransfer = new FileTransfer();
fileTransfer.download("/",saveFileName,
function(entry) {
alert("download complete");
},
function(error) {
alert("download error source " + error.source);
alert("download error target " + error.target);
alert("upload error code" + error.code);
}
); |
|