Node.js fs open() open file asynchronously

Description

Node.js fs open() open file asynchronously

var fs = require('fs');

// Asynchronous - Openning File
console.log('Going to open a File');
fs.open('input.txt', 'r+', function(err, td) {
  if (err) {/*  w  ww .ja  va  2 s.  c om*/
    return console.error(err);
  }
  console.log('File open successfully !');
});



PreviousNext

Related