diff --git a/AUTHORS b/AUTHORS index bdf4b8a94f..81524a5466 100644 --- a/AUTHORS +++ b/AUTHORS @@ -52,3 +52,9 @@ Yuichiro MASUI Mark Hansen Zoran Tomicic Jeremy Ashkenas +Scott González +James Duncan +Arlo Breault +Kris Kowal +Jacek Becela +Rob Ellis diff --git a/ChangeLog b/ChangeLog index 5389c3c283..69b78a4382 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,32 @@ -2010.02.22, Version 0.1.30 +2010.03.05, Version 0.1.31 + + * API: - Move process.watchFile into fs module + - Move process.inherits to sys + + * Improve Solaris port + + * tcp.Connection.prototype.write now returns boolean to indicate if + argument was flushed to the kernel buffer. + + * Added fs.link, fs.symlink, fs.readlink, fs.realpath + (Rasmus Andersson) + + * Add setgid,getgid (James Duncan) + + * Improve sys.inspect (Benjamin Thomas) + + * Allow passing env to child process (Isaac Schlueter) + + * fs.createWriteStream, fs.createReadStream (Felix Geisendörfer) + + * Add INI parser (Rob Ellis) + + * Bugfix: fs.readFile handling encoding (Jacek Becela) + + * Upgrade V8 to 2.1.2 + + +2010.02.22, Version 0.1.30, bb0d1e65e1671aaeb21fac186b066701da0bc33b * Major API Changes diff --git a/deps/evcom/evcom.c b/deps/evcom/evcom.c index 1ee02a1f0a..1088181cef 100644 --- a/deps/evcom/evcom.c +++ b/deps/evcom/evcom.c @@ -1139,12 +1139,13 @@ void evcom_stream_force_close (evcom_stream *stream) evcom_stream_detach(stream); } -void +/* Returns the number of bytes flushed to the buffer */ +ssize_t evcom_stream_write (evcom_stream *stream, const char *str, size_t len) { if (!WRITABLE(stream) || GOT_CLOSE(stream)) { assert(0 && "Do not write to a closed stream"); - return; + return -1; } ssize_t sent = 0; @@ -1188,7 +1189,7 @@ evcom_stream_write (evcom_stream *stream, const char *str, size_t len) } /* TODO else { memcpy to last buffer on head } */ assert(sent >= 0); - if ((size_t)sent == len) return; /* sent the whole buffer */ + if ((size_t)sent == len) return sent; /* sent the whole buffer */ len -= sent; str += sent; @@ -1202,7 +1203,7 @@ evcom_stream_write (evcom_stream *stream, const char *str, size_t len) if (ATTACHED(stream)) { ev_io_start(D_LOOP_(stream) &stream->write_watcher); } - return; + return sent; close: stream->send_action = stream_send__close; @@ -1210,6 +1211,7 @@ close: if (ATTACHED(stream)) { ev_io_start(D_LOOP_(stream) &stream->write_watcher); } + return -1; } void diff --git a/deps/evcom/evcom.h b/deps/evcom/evcom.h index fd03a5bf05..3b07289fb5 100644 --- a/deps/evcom/evcom.h +++ b/deps/evcom/evcom.h @@ -194,7 +194,7 @@ void evcom_stream_read_resume (evcom_stream *); void evcom_stream_read_pause (evcom_stream *); void evcom_stream_reset_timeout (evcom_stream *, float timeout); void evcom_stream_set_no_delay (evcom_stream *, int no_delay); -void evcom_stream_write (evcom_stream *, const char *str, size_t len); +ssize_t evcom_stream_write (evcom_stream *, const char *str, size_t len); /* Once the write buffer is drained, evcom_stream_close will shutdown the * writing end of the stream and will close the read end once the server * replies with an EOF. diff --git a/doc/api.txt b/doc/api.txt index 73f4f54c2e..1815dfd695 100644 --- a/doc/api.txt +++ b/doc/api.txt @@ -1,7 +1,7 @@ NODE(1) ======= Ryan Dahl -Version, 0.1.30, 2010.02.22 +Version, 0.1.31, 2010.03.05 == NAME @@ -187,6 +187,8 @@ Like +puts()+ but without the trailing new-line. A synchronous output function. Will block the process and output +string+ immediately to +stdout+. ++log(string)+:: +Output with timestamp. +inspect(object, showHidden, depth)+ :: @@ -783,6 +785,86 @@ Objects returned from +fs.stat()+ and +fs.lstat()+ are of this type. +stats.isSocket()+:: ... +=== +fs.FileReadStream+ + +[cols="1,2,10",options="header"] +|========================================================= +|Event | Parameters | Notes + +|+"open"+ | +fd+ | The file descriptor was opened. +|+"data"+ | +chunk+ | A chunk of data was read. +|+"error"+ | +err+ | An error occured. This stops the stream. +|+"end"+ | | The end of the file was reached. +|+"close"+ | | The file descriptor was closed. +|========================================================= + ++fs.createReadStream(path, [options]);+ :: +Returns a new FileReadStream object. ++ ++options+ is an object with the following defaults: ++ +---------------------------------------- +{ "flags": "r" +, "encoding": "binary" +, "mode": 0666 +, "bufferSize": 4 * 1024 +} +---------------------------------------- + ++readStream.readable+ :: +A boolean that is +true+ by default, but turns +false+ after an +"error"+ +occured, the stream came to an "end", or +forceClose()+ was called. + ++readStream.pause()+ :: +Stops the stream from reading further data. No +"data"+ event will be fired +until the stream is resumed. + ++readStream.resume()+ :: +Resumes the stream. Together with +pause()+ this useful to throttle reading. + ++readStream.forceClose()+ :: +Allows to close the stream before the +"end"+ is reached. No more events other +than +"close"+ will be fired after this method has been called. + +=== +fs.FileWriteStream+ + +[cols="1,2,10",options="header"] +|========================================================= +|Event | Parameters | Notes + +|+"open"+ | +fd+ | The file descriptor was opened. +|+"drain"+ | | No more data needs to be written. +|+"error"+ | +err+ | An error occured. This stops the stream. +|+"close"+ | | The file descriptor was closed. +|========================================================= + ++fs.createWriteStream(path, [options]);+ :: +Returns a new FileWriteStream object. ++ ++options+ is an object with the following defaults: ++ +---------------------------------------- +{ "flags": "r" +, "encoding": "binary" +, "mode": 0666 +} +---------------------------------------- + ++writeStream.writeable+ :: +A boolean that is +true+ by default, but turns +false+ after an +"error"+ +occured or +close()+ / +forceClose()+ was called. + ++writeStream.write(data)+ :: +Returns +true+ if the data was flushed to the kernel, and +false+ if it was +queued up for being written later. A +"drain"+ will fire after all queued data +has been written. + ++writeStream.close()+ :: +Closes the stream right after all queued +write()+ calls have finished. + ++writeStream.forceClose()+ :: +Allows to close the stream regardless of its current state. + == HTTP To use the HTTP server and client one must +require("http")+. @@ -1491,6 +1573,10 @@ Sets the encoding (either +"ascii"+, +"utf8"+, or +"binary"+) for data that is r Sends data on the connection. The second parameter specifies the encoding in the case of a string--it defaults to ASCII because encoding to UTF8 is rather slow. ++ +Returns +true+ if the entire data was flushed successfully to the kernel +buffer. Returns +false+ if all or part of the data was queued in user memory. ++'drain'+ will be emitted when the buffer is again free. +connection.close()+:: diff --git a/doc/index.html b/doc/index.html index e28ae2e8d4..7e6033cbbc 100644 --- a/doc/index.html +++ b/doc/index.html @@ -21,10 +21,8 @@
  • ChangeLog
  • Build
  • About
  • -
  • Demo
  • -
  • Community
  • -
  • Contribute
  • -
  • Benchmarks
  • +
  • Links
  • +
  • Contributing
  • Documentation
  • @@ -98,8 +96,8 @@ server.listen(7000, "localhost"); git repo

    - 2010.02.22 - node-v0.1.30.tar.gz + 2010.03.05 + node-v0.1.31.tar.gz

    Build

    @@ -208,32 +206,42 @@ make install

    -

    Demo

    -

    - A chat room demo is running at Links + +

    + +

    Contributing

    - Patches are always welcome. The process is simple: + Patches are welcome. The process is simple:

    @@ -253,13 +261,10 @@ git format-patch HEAD^
           

    - Feature patches should usually be discussed before putting in the work. + You should ask the mailing list if a new feature is wanted before + working on a patch.

    -

    Benchmarks

    -

    - 2009.09.06 narwhal, node, v8cgi, thin/eventmachine -