Overwriting file
Hello guys,
I know this issue has been posted here a month ago, but It didn't give me any answers.
The context is for a measurement file, that i'm loading in a reactapp. And when I load my measurements, modify, and re-save them, I'd like to overwrite the file and not create another one.
@jimmywarting mentionned that "You can only overwrite the file if you manually set the file to the same name in browsers "save as" dialog.". When I do so, it dowloads another file (If the first one is measurement.txt, the second one will be measurement (1).txt
Is there a way to really overwrite the first file? Thank you in advance!
Matt
This is (unfortunately) out of scope of FileSaver.js, because each browser handles the last part of saving the file to the filesystem themselfes. FileSaver.js has no saying in this due to security considerations.
And then, is there any way of writing in a file with filesaver?
You generate the content of a file in the browser and then save the file with FileSaver.
Sorry that's not what I meant, i mean is there any way of writing in an existing file with filesaver?
Of couse not. You generate the content of a file in the browser and then save the file with FileSaver.
Think about the security if you could just write in an exitsting file.
I don't know if the argument of security quite works here. FileSaver allows to dowload file from browser, this isn't very safe as a basis, but it's true that writing in existing ones is maybe a step further.
Thank you both though for your answers, I'll figure out something else !