I want to edit and read a file using JavaScript using the FileReader API. However, all the tutorials I have found ask me to specify the file parameter using the value from <input type="file">
. Would I be able to set the file parameter as a file address like 'C:/Users/Code/example.txt'.
FileReader API:
function printFile(file) {
const reader = new FileReader();
reader.onload = function(evt) {
console.log(evt.target.result);
};
reader.readAsText(file);
}