ionic downloader plugin code example
Example: ionic download manager
import { Downloader } from '@ionic-native/downloader/ngx';
constructor(private downloader: Downloader) { }
...
var request: DownloadRequest = {
uri: YOUR_URI,
title: 'MyDownload',
description: '',
mimeType: '',
visibleInDownloadsUi: true,
notificationVisibility: NotificationVisibility.VisibleNotifyCompleted,
destinationInExternalFilesDir: {
dirType: 'Downloads',
subPath: 'MyFile.apk'
}
};
this.downloader.download(request)
.then((location: string) => console.log('File downloaded at:'+location))
.catch((error: any) => console.error(error));