How to store pdf file on Local Storage Root Directory in Ionic 2

断了今生、忘了曾经 提交于 2019-12-07 23:56:20

问题


I want to create pdf file using pdfmake and store this pdf on the local root storage directory. new folder should be parallel to other folders like android ,bluetooth. I have given folder list below.

which method will work on this?

I have tried some method of file native like-externalDataDirectory,dataDirectory from http://ionicframework.com/docs/native/file/

  • Internal Storage

|- .IdeaDesktopHD

|- .lelauncher

|- .magic

|- .powercenterhd

|- Alarms

|- Android

|- Audio

|- Bluetooth

|- Contact

|- data

|- DCIM

|- Document

|- Download

|- googleota

|- legc

|- LenovoReaper

|- LesyncDownload

|- Movies

|- MyFavorite

|- Notifications

|- Others

|- Pictures

|- Podcasts

|- powercenterhd

|- Ringtones

|- SHAREit

Any idea which method or function i should use ?


回答1:


try out this

downloadImage(url: string) {

this.fileTransfer.download(encodeURI(url),"file:///storage/emulated/0/folderName/file.pdf")
  .then((
     console.log('
  }, (error) => {
           console.log('error occured');
          });
    }


来源:https://stackoverflow.com/questions/44264105/how-to-store-pdf-file-on-local-storage-root-directory-in-ionic-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!