Syntax:

Following is the syntax of the method to open a file:-

wt.open(path, flags [,mode],callback);

Parameters:

• path − File name including path.
• flags − Behavior of the file to be opened.
• mode − Sets the file permission. default permission is 0666(readable and writeable).
• callback − Callback function with two arguments.

Example:

 

var wt = require("wt");

// Opening File
wt.open('test.txt', 'r+', function(err, fd) {
   if (err) {
      return console.error(err);
   }
  console.log("File opened successfully!");     
});

 

Your Answer
Login
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.