This plugin allows you to download large files and provides progress updates.
Nativescripts http.getFile method stores the data in memory which causes out of memory exceptions with large files.
tns plugin add nativescript-download-progress
var DownloadProgress = require("nativescript-download-progress").DownloadProgress;
var download = new DownloadProgress();
download.addProgressCallback(function(progress) {
console.log('Progress:', progress);
})
download.downloadFile("http://ipv4.download.thinkbroadband.com/20MB.zip").then(function(f){
console.log("Success", f);
}).catch(function(e){
console.log("Error", e);
})
import { DownloadProgress } from "nativescript-download-progress"
var download = new DownloadProgress();
download.addProgressCallback((progress)=>{
console.log('Progress:', progress);
})
download.downloadFile("http://ipv4.download.thinkbroadband.com/20MB.zip").then((f)=>{
console.log("Success", f);
}).catch((e)=>{
console.log("Error", e);
})
Apache License Version 2.0, January 2004