Upgrade or refresh your skills in shell scripting with this article.
There are many strategies to scale your application: Cloning Decomposing Splitting The cluster module helps you to scale your code on one system that has many CPU cores. The idea is: You have one master process and clone your code by forking as many worker processes as you have CPU cores in your system. This […]
Streams are collections of data that might not be available all at once and don’t have to fit in memory all at once. For example if you want to serve a file that is 1GB over HTTP you would create a stream instead of reading the file using readFileSync. A Stream can be piped directly […]
What you can achieve are things like: Create a server Work with streamed data Make API calls Creating an HTTP server We create an HTTP server on port 8080 and respond to any request with a ‘Hello there!’: IncomingMessage extends two interfaces EventEmitter and ReadableStream which allow us to listen to events and process streams, […]
Slow I/O operations such as accessing disk and network resources are handled via Node’s Event Loop. The Event Loop is started once you run a node script and exits once there are no more callbacks to process. Heap and Stack V8 is node’s runtime engine and mainly consists of a Heap and a Stack. The […]
There are a couple of ways to execute files and commands, but all use the module child_process. For example you have child_process.exec creates a shell and also buffers the whole command’s generated output and sends it to a callback function. So use it only if the output is not too big. child_process.execFile runs a file […]
Setting env to debug modules Setting NODE_DEBUG=”http” will output debug info to the console for Node’s http module. Use a comma seperated list to debug more modules at the same time. You can adjust NODE_PATH to tell Node where to look for modules. Setting and reading custom env You can define custom env variables in […]