ionic4 / Angular7-类型“文件”上不存在属性“ dataDirectory”

ebe*_*ren 3 native download ionic4 cordova-native-file

我为需要文件的下载文件用户传输文件,在ionic v3中我也使用它,并且没有任何问题,但是现在在 ionic v4中,当我使用它时,出现了错误:类型'File不存在属性'dataDirectory' '

我的代码=> download.page.ts

download() {
    const fileTransfer: FileTransferObject = this.transfer.create();
    this.plt.ready().then(() => {
      const url = 'http://www.test.com/file.mp3';
      fileTransfer.download(url, this.file.dataDirectory + 'file.mp3').then((entry) => {
        console.log('download complete: ' + entry.toURL());
      }, (error) => {
        // handle error
        console.log('download EROR: ' + error);
      });
    });
  }
Run Code Online (Sandbox Code Playgroud)

在下载页面和提供程序应用程序模块中导入的文件