How to save image from URL into device photo galle

2019-08-07 08:11发布

I am new to ionic and I am developing application using ionic in the application. I need to download the image to the user device when user click on download button. I searched a lot but I am not able to find any proper solution.

1条回答
地球回转人心会变
2楼-- · 2019-08-07 08:30

You can use Transfer plugin from ionic-native.

import { Transfer } from 'ionic-native';
declare var cordova: any;
download() {
  const fileTransfer = new Transfer();
  let url = 'http://www.example.com/file.pdf';
  fileTransfer.download(url, cordova.file.dataDirectory + 'file.pdf').then((entry) => {
    console.log('download complete: ' + entry.toURL());
  }, (error) => {
    // handle error
  });
查看更多
登录 后发表回答