Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

nodejs readfile

const fs = require('fs');

fs.readFile('/Users/joe/test.txt', 'utf8' , (err, data) => {
  if (err) {
    console.error(err);
    return
  }
  console.log(data);
});
Comment

readfile nodejs

const fs = require('fs')

try {
  const data = fs.readFileSync('/Users/joe/test.txt', 'utf8')
  console.log(data)
} catch (err) {
  console.error(err)
}
Comment

fs.readfile

fs.readFile('filename', function read(err, data) {
    if (err) {
        throw err;
    }
    var content = data;
  
    console.log(content);  
   
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: create random aleatory token javascript 
Javascript :: cypress find aria-label 
Javascript :: get text of selected option js 
Javascript :: mm dd yyyy how to get date in this format in javascript 
Javascript :: play a sound wiith js 
Javascript :: document load complete jquery 
Javascript :: convert array to json in js 
Javascript :: delete parent element javascript 
Javascript :: js create events in for always gets last id 
Javascript :: js exec iterate all matches 
Javascript :: vue electron min width 
Javascript :: GridStore is deprecated, and will be removed in a future version. Please use GridFSBucket instead 
Javascript :: mongodb instruction 
Javascript :: jquery select radio 
Javascript :: base64 to string and string to base64 javascript decode 
Javascript :: url regex 
Javascript :: pattern cpf js 
Javascript :: node check if not connected to internet 
Javascript :: remove multiple space to single javascript 
Javascript :: js how to know if element touch border 
Javascript :: sort and split js alefbethic 
Javascript :: .replace is not a function 
Javascript :: javascript discord bot 8 ball command 
Javascript :: express js params 
Javascript :: chart.js change font color 
Javascript :: Check your page, maybe you import jQuery library twice, the slim version or it is missing. 
Javascript :: newtonsoft json deserialize c# example 
Javascript :: javascript get index of object with value in array 
Javascript :: curl accept json 
Javascript :: npx nestjs 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =