I have a flask backend, which sends an image to the vue frontend as described here:
with open('my_image_file.jpg', 'rb') as f:
image_data = f.read()
emit('IMAGE', {'image_data': image_data})
On the vue frontend, the image should ultimately be shown on the webpage. I guess the easiest way would be to somehow save the image in the static Folder. I would have an action like this in my store:
const actions = {
SOCKET_IMAGE (commit, image) {
console.log("image received")
/* What needs to be done to save image in 'static/' ?*/
commit.commit('image_saved')
}
}
I am also open for alternative ways to save the image and render it on the webpage. Can I save the image directly in the vuex store?