Laravel Unduh File dari Storage with Progress Bar

 <script type="text/javascript">
    $(".download").click(function(){
    window.location.href = 'file/30mb.pdf'; //set your file url which want to download
    var data = [];
    for (var i = 0; i < 100000; i++) {
    var tmp = [];
    for (var i = 0; i < 100000; i++) {
    tmp[i] = 'hue';
    }
    data[i] = tmp;
    };
    $.ajax({
    xhr: function () {
    var xhr = new window.XMLHttpRequest();
    xhr.upload.addEventListener("progress", function (evt) {
    if (evt.lengthComputable) {
    var percentComplete = evt.loaded / evt.total;
    //console.log(percentComplete);
    $('.progress').css({
    width: percentComplete * 100 + '%'
    });
    if (percentComplete === 1) {
    $('.progress').addClass('hide');
    }
    }
    }, false);
    xhr.addEventListener("progress", function (evt) {
    if (evt.lengthComputable) {
    var percentComplete = evt.loaded / evt.total;
    console.log(Math.round(percentComplete*100)+"%");
    $(".perc").text(Math.round(percentComplete*100)+"%");
    if((Math.round(percentComplete*100))==100)
    {
    $(".perc").text("download completed");
    $('.progress').removeClass('hide');
    // $(".perc").text("");
    }
    $('.progress').css({
    width: percentComplete * 100 + '%'
    });
    }
    }, false);
    return xhr;
    },
    type: 'POST',
    url: "file/30mb.pdf", //set your file url which want to download
    data: data,
    success: function (data) {}
    });
    });

    </script>
Zeevx