Answers for "how to read local text file in javascript"

2

read file javascript

// As with JSON, use the Fetch API & ES6
fetch('something.txt')
  .then(response => response.text())
  .then(data => {
  	// Do something with your data
  	console.log(data);
  });
Posted by: Guest on March-15-2020
1

html get text from file

<embed src="file.txt"> // This will show the text contained in file.txt in the page
Posted by: Guest on November-14-2020
2

how to load localt ext file in js

const fileUrl = '' // provide file location

fetch(fileUrl)
   .then( r => r.text() )
   .then( t => console.log(t) )
Posted by: Guest on June-03-2020

Code answers related to "how to read local text file in javascript"

Browse Popular Code Answers by Language