Posts

Showing posts from September, 2018

First time contributing to a open source project

The first open source project that I have contributed to is filer.js. The hardest part of contributing to an open source project was "Where do I start?". Our professor has gave us two options to where to start. 1. Finding a bug to fix. 2. Creating a test case for an existing function. I chose the second option because I feel that it would be harder to find bugs. Getting Set up: To look at existing test cases, I would have to physically look through the code so I downloaded the project on to my computer. I thought about using Visual Studio, the code editor I use for C++  and Java but filer.js is JavaScript so I decided it's time to try a different code editor(one that starts up faster on my computer). I downloaded one called "Atom" and the start-up was a lot faster comparing to VS and when I opened the project, the directories were perfectly lined up on the left side so I started searching for the test files. Looking for test cases that I could potentially

Node.js

Node.js filesystem: ReadFile vs ReadFileSync ReadFile fs.ReadFile() takes 3 arguments: 1. The first argument this function takes is "path" Path takes in a string, integer or an URL for the filename or file descriptor. 2. The second argument this function takes is "options" Options can take in a string to indicate a specific encoding of a file 3. The last argument it take is a "callback" Callback takes in a function that is used for error handling or continue the program. ReadFileSync For this version of ReadFile it only takes  2 arguments: The first two arguments are the same as fs.ReadFile() it takes the path and options. Now the main question is when is it time to use one over the other? For this question you would need to ask yourself "Do you need to do things at the same time or do you need the program to wait until you finish a part?" If you needed to run the whole program then you would need to use the fs.ReadFile()