Skip to content
Advertisement

How to get File type object from url (image) in vuejs

I do have an image url lets say http://localhost/sample.jpg. i want to save this image url into a File object type as my component created. how can i achieve this with native js api?

JavaScript

Advertisement

Answer

One of the simple ways to do this is using fetch.

JavaScript

After you have blob you can convert it to file. See How to convert Blob to File in JavaScript.

Example

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement