File read/write

Develop and Deploy Native Apps for Windows, OS X, Linux, Unix ...
Post Reply
sedrok
Posts: 26
Joined: Tue Jun 03, 2014 12:50 pm

File read/write

Post by sedrok »

As i understood Node.js can be used:

read: javascript code
fs = require('fs');
            fs.readFile('c:\\test.txt', 'utf8', function (err,data) {
            if (err) {
               return console.log(err);
            }
            console.log(data);
            });
write: javascript code
var fs = require('fs');
fs.writeFile("c:\\test.txt", "Hey there!", function(err) {
    if(err) {
        console.log(err);
    } else {
        console.log("The file was saved!");
    }
});
Attachments
5yj4g334f4.jpg
5yj4g334f4.jpg (159.76 KiB) Viewed 7770 times

Post Reply