From 54f02345b5bd456900643456857c98fec0dc8e02 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 9 Apr 2010 15:50:38 -0700 Subject: [PATCH] Fix doc again --- Makefile | 2 +- doc/api.markdown | 30 ++++++++++++++++++------------ doc/api_header.html | 9 ++++++++- doc/manpage.xsl | 28 ---------------------------- 4 files changed, 27 insertions(+), 42 deletions(-) delete mode 100644 doc/manpage.xsl diff --git a/Makefile b/Makefile index b2c0cfc623..10de43a4fb 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ benchmark: all doc: doc/node.1 doc/api.html doc/index.html doc/changelog.html ## HACK to give the ronn-generated page a TOC -doc/api.html: doc/api.markdown +doc/api.html: doc/api.markdown doc/api_header.html doc/api_footer.html ronn -f --html doc/api.markdown \ | sed "s/

\(.*\)<\/h2>/

\1<\/h2>/g" \ | cat doc/api_header.html - doc/api_footer.html > doc/api.html diff --git a/doc/api.markdown b/doc/api.markdown index c59ac55a09..a3ab8ad7b3 100644 --- a/doc/api.markdown +++ b/doc/api.markdown @@ -91,7 +91,7 @@ Use `process.mixin()` to include modules into the global namespace. puts('The area of a circle of radius 4 is ' + area(4)); -## String Encodings and Buffers +## Buffers Pure Javascript is Unicode friendly but not nice to pure binary data. When dealing with TCP streams or the file system, it's necessary to handle octet @@ -381,7 +381,7 @@ your program's flow. Especially for server programs that are designed to stay running forever, `uncaughtException` can be a useful safety mechanism. -### Signal Events: 'SIGINT' +### Signal Events `function () {}` @@ -849,7 +849,7 @@ Example: grep = spawn('grep', ['ssh']); sys.puts('Spawned child pid: ' + grep.pid); - grep.stdin.close(); + grep.stdin.end(); ### child.stdin.write(data, encoding) @@ -877,7 +877,7 @@ Example: A very elaborate way to run 'ps ax | grep ssh' if (code !== 0) { sys.puts('ps process exited with code ' + code); } - grep.stdin.close(); + grep.stdin.end(); }); grep.stdout.addListener('data', function (data) { @@ -895,7 +895,7 @@ Example: A very elaborate way to run 'ps ax | grep ssh' }); -### child.stdin.close() +### child.stdin.end() Closes the child process's `stdin` stream. This often causes the child process to terminate. @@ -909,7 +909,7 @@ Example: sys.puts('child process exited with code ' + code); }); - grep.stdin.close(); + grep.stdin.end(); ### child_process.exec(command, callback) @@ -1359,6 +1359,8 @@ Begin accepting connections on the specified port and hostname. If the hostname is omitted, the server will accept connections directed to any address. +To listen to a unix socket, supply a filename instead of port and hostname. + This function is asynchronous. `listening` will be emitted when the server is ready to accept connections. @@ -1698,7 +1700,7 @@ A reference to the `http.Client` that this response belongs to. ## net.Server -This class can be used to create a TCP or UNIX server. +This class is used to create a TCP or UNIX server. Here is an example of a echo server which listens for connections on port 7000: @@ -1719,6 +1721,11 @@ on port 7000: }); server.listen(7000, 'localhost'); +To listen on the socket `'/tmp/echo.sock'`, the last line would just be +changed to + + server.listen('/tmp/echo.sock'); + This is an EventEmitter with the following events: ### Event: 'listening' @@ -1737,11 +1744,10 @@ Emitted when a new connection is made. `stream` is an instance of ### Event: 'close' -`function (errno) {}` +`function () {}` + +Emitted when the server closes. -Emitted when the server closes. `errorno` is an integer which indicates -what, if any, error caused the server to close. If no error occurred -`errorno` will be 0. ### net.createServer(connectionListener) @@ -2244,7 +2250,7 @@ The library is called `/repl.js` and it can be used like this: net.createServer(function (c) { sys.error('Connection!'); nconnections += 1; - c.close(); + c.end(); }).listen(5000); repl.start('simple tcp server> '); diff --git a/doc/api_header.html b/doc/api_header.html index e3338bc95e..498bc9ebd3 100644 --- a/doc/api_header.html +++ b/doc/api_header.html @@ -53,10 +53,11 @@ #man { width: 50%; - margin: 0 0 0 22em; + margin: 0 0 0 17em; } #toc { + font-family:consolas,monospace; position: fixed; left: 0; top: 0; @@ -65,10 +66,16 @@ border-right: 1px solid #ccc; overflow: auto; } + #toc #toctitle { background: #eee; padding: 1em; } + +#toc a { + text-decoration: none; +} + #toc ul { list-style: none; margin: 0; diff --git a/doc/manpage.xsl b/doc/manpage.xsl deleted file mode 100644 index 6f7d3336ed..0000000000 --- a/doc/manpage.xsl +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - -