Command Line / Node.js Flashcards
What is a CLI?
Command-line interface - a form of user interface that processes commands to a computer program in the form of lines of text
What is a GUI?
Graphical user interface - a form of user interface that allows users to interact with electronic devices through graphical icons instead of text-based user interfaces
What does the man command do?
displays manual for command information
What does the cat command do?
concatenate files and prints to the command prompt
What does the ls command do?
list directory contents
What does the pwd command do?
print name of the current/working directory
What does the echo command do?
display a line of text
What does the touch command do?
create an empty file; change file timestamps
What does the mkdir command do?
make directories
What does the mv command do?
move/rename files or directories
What does the rm command do?
remove files or directories
What does the cp command do?
copy files and directories
What are the three virtues of a great programmer?
laziness, impatience, hubris
What is Node.js?
a program that allows JavaScript to be run outside of a web browser
What can Node.js be used for?
to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform
What is a REPL?
Read–eval–print loop: a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user
When was Node.js created?
2009
What back end languages have you heard of?
Python, Ruby, Java, PHP
What is a computer process?
the instance of a computer program that is being executed by one or many threads
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
8
Why should a full stack Web developer know that computer processes exist?
Full stack Web development is based on making multiple processes work together to form one application
What is the process object in a Node.js program?
a global that provides information about, and control over, the current Node.js process
How do you access the process object in a Node.js program?
just type process
What is the data type of process.argv in Node.js?
array
What is a JavaScript module?
a single .js file
What values are passed into a Node.js module’s local scope?
__dirname, __filename, exports, module, require( )
Give two examples of truly global variables in a Node.js program.
console, process
What is the purpose of module.exports in a Node.js module?
functions can be assigned to module.exports - makes them available to other modules by calling require( )
How do you import functionality into a Node.js module from another Node.js module?
const variableName = require( ‘./fileName );
What is the JavaScript Event Loop?
a concurrency model that is responsible for executing the code, collecting and processing events, and executing queued sub-tasks
What is the difference between “blocking” and “non-blocking” with respect to how code is executed?
blocking code sits on the stack until it is executed, while non-blocking code is pushed off onto the task queue to be executed later
What is a directory?
structure of a file system that stores files
What is a relative file path?
location of a file/directory relative to the current file/directory
What is an absolute file path?
full URL to a file
What method is available in the Node.js fs module for writing data to a file?
fs.writeFile( )
Are file operations using the fs module synchronous or asynchronous?
asynchronous (unless explicitly using the sync fs methods)