comp 2406 assignment 1
In this assignment you will writing two programs, words-sync.js and words-async.js. These programs will make use of synchronous and asynchronous I/O is the manner of the programs from Tutorial 1.These programs should both behave as follows:
- They should take two arguments, an input text file and an output file to create. Thus you run them by typing "node words-sync.js document.txt wordlist.txt", with document.txt being the file to be read and wordlist.txt is the file to be created.
- Once the output file has been created, the program should output "Finished!" to the console.
- For the purposes of this program, words can be defined as anything matching the \w operator. In other words, to split the document into words you may call split() using /\W/ as the split regular expression.
- You may assume that the input file exists and is readable and the output file is writable. In other words you do not need to do any error checking (although it is appreciated).
- 3 points for producing the correct output given well-formed input.
- 2 points for correctly structuring the code in the synchronous version.
- 5 points for correctly structuring the code in the asynchronous version. In particular, "Finished!" should only be output when the program is truly finished!
- list any references you used to complete the assignment (documentation web sites, for example),
- list your collaborators, and
- optionally, should discuss any issues or concerns you had when completing this assignment.
You'll get 1 file (1.6KB)