Monday, 17 April 2017

fs.open in Node.js

I create two files,one is main.js,let's see it

var fs = require("fs");
console.log("begin");
fs.open("a.txt",'r',function (err,fd) {
    if(err){
        return console.log(err);
     }
    console.log(fd.toString());
})

another file is a.txt

hello world

Now i run node main.js

enter image description here

I can't understand why it show "12"



via baiying

No comments:

Post a Comment