LAB 1 - creating file using node.js fs module

LAB 1 #opensource Creating file using node.js fs module: If we want to work with file system in node, we will need to learn how to create files. In this blog post I will describe how to create and open files in node.js using the "fs" module. Here are the steps to do it: var fs = require('fs'); Include a module to your code. There are couple of methods to create a file: fs.writeFile("< fileName >",< content >,< callbackFunction> ); In this case a new file is created with the provided name. After filling the file with content, callback function is called. If a file already exists , the file gets overwritten with a new file. fs.appendFile( "< fileName >",< content >,< callbackFunction> ); This function appends content to the file. After filling the file with content, callback function is called. If the file does not exist, a new file is created with the name and content provided. Opening a file...