Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

img src to file javascript

const img = document.getElementById('id')

fetch(img.src)
.then(res => res.blob())
.then(blob => {
  const file = new File([blob], 'dot.png', blob)
  console.log(file)
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #img #src #file #javascript
ADD COMMENT
Topic
Name
3+6 =