The Event Loop, Node fs readFile and writeFile Flashcards

1
Q

What is the JavaScript Event Loop?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is different between “blocking” and “non-blocking” with respect to how code is executed?

A

Blockingis when the execution of additional JavaScript in the Node.js process must wait until a non-JavaScript operation completes.
Non-blockingmethods executeasynchronously.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a directory?

A

Also called folders

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a relative file path?

A

Relative file path to current directory (doesn’t start with a slash)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an absolute file path?

A

Absolute path contains the root of element and the complete directory list required to location file. Starts with a slash

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What module does Node.js include for manipulating the file system?

A

The fs (file system) module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What method is available in the Node.js fs module for writing data to a file?

A

writeFile( ) method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Are file operations using the fs module synchronous or asynchronous?

A

Both. The ones that are synchronous will have ‘sync’ in the name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly