Danny Drinkwater
Danny Drinkwater

Reputation: 41

Is there a way of downloading a file (such as PDF) and storing it on the device with Capacitor?

Is it possible to download and store files (accessing the file system) with Capacitor? I've only been able to find Cordova plugins, but would like to keep the app pure using Ionic and Capacitor.

Upvotes: 0

Views: 2554

Answers (2)

Tiwari
Tiwari

Reputation: 50

You can use Filesystem plugin for Capacitor to handel file-system and you can write your file inside directory You can find reference for plugin here.

downloadFile(options: DownloadFileOptions) => Promise<DownloadFileResult>

Upvotes: 0

Gabriel Bianconi
Gabriel Bianconi

Reputation: 100

You should simply use download() method like this:

this.pdfObj.download();

Here you can find more info: https://forum.ionicframework.com/t/do-you-know-how-to-save-and-open-a-pdf-using-capacitor-and-ionic-4/158634/3

Upvotes: 0

Related Questions