Suppose I have an image URL like http://localhost/sample.jpg
. What is the best way to save this image URL into a File
object using native JavaScript API in my component?
export default {
created () {
const imageUrl = 'http://localhost/sample.jpg'
const file = this.getFileFromUrl(imageUrl)
},
methods: {
getFileFromUrl (url) {
// ... what should i return?
}
}
}