我正在尝试与ngCordova
但是cordova.file.documentsDirectory
财产是null
.
我也尝试过结合使用ngCordova
with requestFileSystem
,但是该文件仍然没有保存在“下载”中。
我的代码示例:
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(directory) {
var fileTransfer = new FileTransfer();
fileTransfer.download(
encodeURI("http://example.com/sample.pdf"),
directory.root.nativeURL + 'sample.pdf',
function(entry) {
console.log("download complete: " + entry.fullPath);
},
function(error) {
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("upload error code" + error.code);
},
false
);
}, function(err){console.error(err)});
Thanks.
cordova.file.externalRootDirectory + '/Download/' + 'sample.pdf'
代替directory.root.nativeURL + 'sample.pdf'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)