I am trying to create a chrome extension that downloads a file with text inside. Some examples for doing this I've seen need to create a URL to pass to
chrome.downloads.download({ url: url, filename: fileName, conflictAction: 'overwrite', saveAs: false });
However, when I try to use URL.createUrlObject(), I get a type error
var blob = new Blob([textFile], {type: 'application/octet-binary'}); var url = URL.createObjectURL(blob);
I am using manifest v3
data
URL e.g. 'data:text/plain,' + textFile.replace(/#/g, '%23') – Selfcontradictionbtoa
instead ofchrome.window.btoa
. Ask a new question for further assistance if necessary. – SelfcontradictionURL.createObjectURL
does and why it is not allowed in Service Workers. – Whiny