diff --git a/website/api.html b/website/api.html index 59bb15a4ac..3b3bcdbaf5 100644 --- a/website/api.html +++ b/website/api.html @@ -13,6 +13,7 @@
  1. Timers
  2. +
  3. Processes
  4. File I/O
      @@ -130,6 +131,66 @@
      Stops a interval from triggering.
      +

      Processes and IPC

      + +

      + Node provides a tridirectional popen(3) facility. + It is possible to stream data through the child's stdin, + stdout, and stderr in a fully non-blocking + way. +

      + +
      +
      new node.Process(command)
      +
      Launches a new process with the given command. For example: +
      var ls = new Process("ls -lh /usr");
      +
      + +
      process.pid
      +
      The PID of the child process.
      + +
      process.onOutput = function (chunk) { };
      +
      A callback to receive output from the process's stdout. + At the moment the received data is always a string and utf8 encoded. + (More encodings will be supported in the future.) + +

      If the process closes it's stdout, this callback will + be issued with null as an argument. Be prepared for this + possibility. +

      + +
      process.onError = function (chunk) { };
      +
      A callback to receive output from the process's stderr. + At the moment the received data is always a string and utf8 encoded. + (More encodings will be supported in the future.) + +

      If the process closes it's stderr, this callback will + be issued with null as an argument. Be prepared for this + possibility. +

      + +
      process.onExit = function (exit_code) { };
      +
      A callback which is called when the sub-process exits. The argument + is the exit status of the child. +
      + +
      process.write(data, encoding="ascii");
      +
      Write data to the child process's stdin. The second + argument is optional and specifies the encoding: possible values are + "utf8", "ascii", and "raw". +
      + +
      process.close();
      +
      Closes the processes stdin stream.
      + +
      process.kill(signal=node.SIGTERM);
      +
      Kills the child process with the given signal. If no argument is + given, the process will be sent node.SIGTERM. The standard + POSIX signals are defined under the node namespace (e.g. + node.SIGINT, node.SIGUSR1). +
      +
      +

      node.fs