Do you mean downloading a file from a URL?
If that is the case, you first need to read the URL as a blob. I think you can do this with FileReader or with a simple fetch/ajax/http request. Then, once you have the Blob you can use my method above to download it.
It would look something like this:
const url ='http://sample.example.file.doc' const options = {}; fetch(url, options) .then( res => res.blob() ) .then( blob => { downloadBlob(blob, 'filename.doc'); });
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Do you mean downloading a file from a URL?
If that is the case, you first need to read the URL as a blob. I think you can do this with FileReader or with a simple fetch/ajax/http request. Then, once you have the Blob you can use my method above to download it.
It would look something like this: