Really confused with a single-thread Node.js execution model

Ok, I'm learning Node.js, but I couldn't think of this expectation model. I learn it by reading the Node Beginner Book . It has a section on blocking and non-blocking operations. I do not understand that these are non-blocking operations.

Here is the code:

var exec = require("child_process").exec;

function start(response) {
  console.log("Request handler 'start' was called.");

  exec("ls -lah", function (error, stdout, stderr) {
    response.writeHead(200, {"Content-Type": "text/plain"});
    response.write(stdout);
    response.end();
  });
}

function upload(response) {
  console.log("Request handler 'upload' was called.");
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("Hello Upload");
  response.end();
}

exports.start = start;
exports.upload = upload;

, exec, exec ls -lah. ? , exec "find/" , 30 , "find/" . , 1, 2 . ? , 1 30 , 2 1 , 1 "find/" ?

, noobish. !

+5
1

node.js - . find . : node.js.

+4

All Articles