Posts

Showing posts from September, 2018

release 0.1

Release 0.1 - Blog Post #opensource The begging - LAB 2 At the beginning of the lab 2 (which is the part of this assignment) I started to work on the bug called "Add test for mkdir with restricted symbols. I noticed that there isn't a test for the case that you call mkdir with a path that includes a restricted symbol. It should fail to create the illegal path name." But when I started to work on release I had a conversation with my professor - David and we found out that this is not even a bug, and it shouldn't be fixed, because node actually let's you to create invalid path and we need to do it as well. The function that was written for that "bug" is below: it ( 'Should not create dir with restricted symbols (using promises)' , () => { var fsPromises = util . fs (). promises ; return fsPromises . mkdir ( '/?' ). catch ( error => { expect ( error ). to . exist ; expect ( error . code ). to . equal ( 'EN

LAB 1 - creating file using node.js fs module

Image
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