File System
Node.js includes fs module to access physical file system. The fs module is responsible for all the asynchronous or synchronous file I/O operations.
Reading File
fs.readFile(fileName [,options], callback)
var fs = require('fs');
fs.readFile('TestFile.txt', function (err, data) {
if (err) throw err;
console.log(data);
});
$.getJSON('http://example.com/ajax', function (data) {
console.log('IO...');
});
console.log('No wait for IO...');Last updated