The Event Loop, Node fs readFile and writeFile Flashcards
What is the JavaScript Event Loop?
The Event Loop is a queue of callback functions. Takes the first thing on the callback queue and puts it back on the stack if the stack is empty
What is different between “blocking” and “non-blocking” with respect to how code is executed?
Blockingis when the execution of additional JavaScript in the Node.js process must wait until a non-JavaScript operation completes.
Non-blockingmethods executeasynchronously.
What is a directory?
Also called folders
What is a relative file path?
Relative file path to current directory (doesn’t start with a slash)
What is an absolute file path?
Absolute path contains the root of element and the complete directory list required to location file. Starts with a slash
What module does Node.js include for manipulating the file system?
The fs (file system) module
What method is available in the Node.js fs module for writing data to a file?
writeFile( ) method
Are file operations using the fs module synchronous or asynchronous?
Both. The ones that are synchronous will have ‘sync’ in the name.