Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The first task was to investigate File I/O.  The fs module is needed to read and write to files and the readline module is needed to read standard in from the terminal.  The fs module allows the programmer to open a wide variety: txt files (which are basic ASCII text files), csv files (which are also ASCII text files), and pdfs (which are binary files), although pdfs when printed do not look like their original form because the binary version is printed:

Image Added

The user can input to the file directly using the readline module by creating an interface and setting the input as the stdin and the output as the stdout (which both interact with the terminal).  It is interesting because although I do the stdin interaction at the end of the program, it prints the question at the beginning of the file, and then waits for user input at the end.

Image Added

The main difference between files and strings is how they are generated.  Files need the module to read the file, but then the contents of the file are copied into a local variable in the program that can print it very similar to a string.  Thus, once a file has been opened, its copied contents are similar to a string.  

...