# Pastebin hma74J7W var reader = new FileReader(); reader.onload = function(e) { var fetchPromise = fetch(this.urlBase + url, { method: 'POST', mode: 'cors', redirect: 'follow', body: e.currentTarget.result }); fetchPromise.then(function (response) { return response.json() }).then((function (json) { document.body.dispatchEvent(new CustomEvent(eventKey, {detail: json})); }).bind(this)) }.bind(this); reader.readAsText(new Blob([body.arg]));