DEV Community

Discussion on: What is NodeJS?

Collapse
peerreynders profile image
peerreynders

What is Event driven programming?

For an example of event driven programming see How to use fs.createReadStream? The capabilities revolve around EventEmitter.

Both examples you provided simply use callbacks to deliver a result or error - the most basic form of asynchronous processing where you provide a callback function to continue processing later once either result or error become available, so e.g. fs.readfile() can simply return - non-blocking - without reading any of the file yet (The Node.js Event Loop, Timers, and process.nextTick()).