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 :: active navbar in page reactjs 
Javascript :: set cookie using nest js 
Javascript :: repeat array in js 
Javascript :: add parameters ajax request 
Javascript :: Send Post Fetch REquest With Django 
Javascript :: mongoose delete 
Javascript :: jasmine spy return value when using create Spy Object angular 2 
Javascript :: netmask /24 
Javascript :: random positive or negative javascript 
Javascript :: angular hostlistener 
Javascript :: js fetch api 
Javascript :: next js page loader 
Javascript :: javascript get time 
Javascript :: json load 
Javascript :: how can i convert object to an array javascript 
Javascript :: array iteration 
Javascript :: node js connect to mongodb using mongoose 
Javascript :: loadtest node 
Javascript :: how to destroy cookie in javascript 
Javascript :: base64 encoded data to object in javascript 
Javascript :: discord.js setactivity 
Javascript :: get current html file name javascript 
Javascript :: textarea javascript set value 
Javascript :: javascript Compare two arrays regardless of order 
Javascript :: onload of modal jquery function 
Javascript :: jquery: select select box rpogramatically 
Javascript :: jquery get all value from class 
Javascript :: passportjs serializeuser 
Javascript :: innertext 
Javascript :: how to create a filelist object in javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =