我使用FileTransfer-Plugin通过API下载文件。下载后我想用FileOpener-Plugin打开文件。 FileOpener需要文件的mime类型,但data.type(mime-type)返回null。
File.resolveLocalFilesystemUrl(cordova.file.cacheDirectory)
.then((dirEntry) => {
this.transfer.download(url, path, true, {headers: headers})
.then((entry) => {
entry.file((data) => {
console.log('MimeType: ', data.type); // returns null
});
});
});
它没有设置mime类型,但我觉得它更好。有人知道这个问题。我在iOS工作。
数据返回:
结束:683008
lastModified:1497256786396.6
lastModifiedDate:1497256786396.6
localURL:“cdvfile://localhost/cache/file.ext”
name:“file.ext”
尺寸:683008
开始:0
type:null