I\'m exploring node.js for quite some time now. But yet haven\'t figured out exactly, how a program executes.
For e.g. taking this simple program:
/
null
or an Error
instance and the other is the data. This method receives a Buffer
as the second argument. A quick-and-easy way to convert a buffer to a string is data.toString()
which converts the list of bytes into a UTF-8 encoded string.You'll notice that pretty much every Node module uses this callback signature; an optional Error
and then the data.
When running from the command line, you'll notice that the app quits when the last IO action is finished. Node keeps track of this itself. When building a web app, the open HTTP(S) connection will keep the process 'busy'.