How to convert Blob to File in JavaScript

I need to upload an image to NodeJS server to some directory. I am using connect-busboy node module for that. I had the dataURL of the image that I converted to blob using the following code: dataURLToBlob: function(dataURL) { var BASE64_MARKER = ‘;base64,’; if (dataURL.indexOf(BASE64_MARKER) == -1) { var parts = dataURL.split(‘,’); var contentType = … Read more

JavaScript blob filename without link

How do you set the name of a blob file in JavaScript when force downloading it through window.location? function newFile(data) { var json = JSON.stringify(data); var blob = new Blob([json], {type: “octet/stream”}); var url = window.URL.createObjectURL(blob); window.location.assign(url); } Running the above code downloads a file instantly without a page refresh that looks like: bfefe410-8d9c-4883-86c5-d76c50a24a1d I … Read more