download(URL, convert_to_blob = true) {
        var request = new XMLHttpRequest();
        const p = new Promise( (success, fail) => {
            request.onload = () => {
                if (request.status === 200) {
                    const blob = request.response;
                    success(blob);
                } else {
                    fail(request);
                }
            };
        });

        request.open('GET', URL, true);
        if (convert_to_blob) {
            request.responseType = 'blob';
        }
        request.send();

        return p;
    }
Download file from URL via AJAX and make Blob object or return base64 string if 2nd argument is false
Only files from CORS-enabled domains can be downloaded or AJAX will get security error

@param {String} URL
@param {Boolean} convert_to_blob = true
@returns {Promise}: success(Blob object | base64 string), fail(response XHR object)