-6

Supposed I have an html element of image

enter image description here

is it possible to convert that html element to become a file just like this

enter image description here

Any idea how can I do this? Do I need to use casting

Beginner
  • 1,700
  • 4
  • 22
  • 42

1 Answers1

2

Not as such.

You could:

  1. read the src attribute
  2. make a fresh HTTP request to it with fetch
  3. convert the response to a blob
  4. convert the blob to a file
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335