node-v0.1.30

70 views
Skip to first unread message

r...@tinyclouds.org

unread,
Feb 22, 2010, 4:37:34 AM2/22/10
to nodejs
2010.02.22, Version 0.1.30

* Major API Changes

- Promises removed. See
http://groups.google.com/group/nodejs/msg/426f3071f3eec16b
http://groups.google.com/group/nodejs/msg/df199d233ff17efa
The API for fs was

fs.readdir("/usr").addCallback(function (files) {
puts("/usr files: " + files);
});

It is now

fs.readdir("/usr", function (err, files) {
if (err) throw err;
puts("/usr files: " + files);
});

- Synchronous fs operations exposed, use with care.

- tcp.Connection.prototype.readPause() and readResume()
renamed to pause() and resume()

- http.ServerResponse.prototype.sendHeader() renamed to
writeHeader(). Now accepts reasonPhrase.

* Compact garbage on idle.

* Configurable debug ports, and --debug-brk (Zoran Tomicic)

* Better command line option parsing (Jeremy Ashkenas)

* Add fs.chmod (Micheil Smith), fs.lstat (Isaac Z. Schlueter)

* Fixes to process.mixin (Rasmus Andersson, Benjamin Thomas)

* Upgrade V8 to 2.1.1

Download: http://nodejs.org/dist/node-v0.1.30.tar.gz

Website: http://nodejs.org/

Documentation: http://nodejs.org/api.html

r...@tinyclouds.org

unread,
Feb 22, 2010, 4:44:42 AM2/22/10
to nodejs
If you need promises for legacy code, then include this file in your
application: http://gist.github.com/310562.

Micheil Smith

unread,
Feb 22, 2010, 4:54:52 AM2/22/10
to nod...@googlegroups.com
Hey, there's an issue in the documentation, here's the patch:

--

From 0f10c69eee8dbffb71b1b6964afc5957b56a33b9 Mon Sep 17 00:00:00 2001
From: Micheil Smith <mic...@brandedcode.com>
Date: Mon, 22 Feb 2010 20:53:51 +1100
Subject: [PATCH] Fixing a mistype in the documentation for fs.readdir & fs.readdirSync

---
doc/api.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/doc/api.txt b/doc/api.txt
index 942058f..639a252 100644
--- a/doc/api.txt
+++ b/doc/api.txt
@@ -635,7 +635,7 @@ Asynchronous readdir(3). Reads the contents of a directory.
The callback gets two arguments +(err, files)+ where +files+ is an array of
the names of the files in the directory excluding +"."+ and +".."+.

-+fs.readdir(path, callback)+ ::
++fs.readdirSync(path)+ ::
Synchronous readdir(3). Returns an array of filenames excluding +"."+ and
+".."+.

--
1.6.5.7

--

Micheil.

On 22/02/2010, at 8:44 PM, r...@tinyclouds.org wrote:

> If you need promises for legacy code, then include this file in your
> application: http://gist.github.com/310562.
>

> --
> You received this message because you are subscribed to the Google Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com.
> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
>

Avi Flax

unread,
Feb 22, 2010, 11:39:56 AM2/22/10
to nod...@googlegroups.com
On Mon, Feb 22, 2010 at 04:37, <r...@tinyclouds.org> wrote:

> 2010.02.22, Version 0.1.30

Another impressive release — awesome!

>    - http.ServerResponse.prototype.sendHeader() renamed to
>      writeHeader(). Now accepts reasonPhrase.

Nice, I really like the improvement, it's great to be able to specify
the reason phrase.

However, I'm still concerned by the dissonance between the HTTP spec
and this API. The function being named "writeHeader" implies that it's
for writing a HTTP header — but it's not. Another way to say this is
that it implies that in HTTP there's a concept named "header" which
includes the status code, reason phrase, and headers — but there
isn't.

I still think this should be changed. I got the impression in a
previous thread that you were open to renaming the function. But if
you've changed your mind, and you're sick of me asking about this,
just say so and I'll drop it. If you're still open to it, I'd be happy
to contribute a patch.

Also, here's a patch for the docs:

diff --git a/doc/api.txt b/doc/api.txt
index 942058f..74ca74f 100644
--- a/doc/api.txt
+++ b/doc/api.txt
@@ -922,7 +922,7 @@ The +http.Connection+ object.
This object is created internally by a HTTP server--not by the user. It is
passed as the second parameter to the +"request"+ event.

-+response.writeHeader(statusCode[, reasonPhrase] , headers)+ ::
++response.writeHeader(statusCode[, reasonPhrase][, headers])+ ::

Sends a response header to the request. The status code is a 3-digit HTTP
status code, like +404+. The last argument, +headers+, are the
response headers.

As you can see, it just indicates that the headers param is also optional.

Thanks!
Avi

--
Avi Flax » Partner » Arc90 » http://arc90.com
➙ Have you tried Kindling‽ http://kindlingapp.com

Michael J. I. Jackson

unread,
Feb 22, 2010, 11:58:10 AM2/22/10
to nod...@googlegroups.com
Love the new syntax for the former promise functions. Feels much more natural.

--
Michael J. I. Jackson
http://mjijackson.com/
@mjijackson


Karl Guertin

unread,
Feb 22, 2010, 12:50:13 PM2/22/10
to nod...@googlegroups.com
On Mon, Feb 22, 2010 at 4:37 AM, <r...@tinyclouds.org> wrote:
>  * Upgrade V8 to 2.1.1

This is a fairly big deal because this version of v8 includes:

[ES5] Implemented Object.defineProperty

This means that it's now possible to define attributes that are
non-modifiable and non-enumerable and in particular you can add
properties to Object.prototype without breaking for..in loops. See
Resig's description [1] for more details.

[1] http://ejohn.org/blog/ecmascript-5-objects-and-properties/

lollicode

unread,
Feb 22, 2010, 2:31:26 PM2/22/10
to nodejs
Ryan, I believe there's a small error in your promise lib gist.

Ligne 4, instead of:
exports.EventEmitter.call(this);

I think it should read:
events.EventEmitter.call(this);

Cheers

Joran Greef

unread,
Feb 22, 2010, 2:56:08 PM2/22/10
to nodejs
Thank you.

opichals

unread,
Feb 22, 2010, 4:48:48 PM2/22/10
to nodejs
Hi Ryan!

Nice stuff! Thanks for the release!

Just an idea, what about creating fs.sync.xxx instead of exposing a
lot of fs.xxxSync named methods?

Best Regards
Standa


On Feb 22, 10:37 am, r...@tinyclouds.org wrote:
> 2010.02.22, Version 0.1.30
>

Stephen Belanger

unread,
Feb 22, 2010, 5:58:58 PM2/22/10
to nod...@googlegroups.com
or require('fsSync')

...keeping it as an entirely separate module.

Marak Squires

unread,
Feb 22, 2010, 6:02:02 PM2/22/10
to nod...@googlegroups.com
was process.mixing bugged at all? i was experiencing some odd behavior with it the other day

Benjamin Thomas

unread,
Feb 22, 2010, 6:25:38 PM2/22/10
to nod...@googlegroups.com
On Mon, Feb 22, 2010 at 4:02 PM, Marak Squires <marak....@gmail.com> wrote:
> was process.mixing bugged at all? i was experiencing some odd behavior with
> it the other day

It was: http://github.com/ry/node/commit/49cd1bbf84271f5a59954a176fc79a99814afa8b

But shouldn't be problematic now...

Marak Squires

unread,
Feb 22, 2010, 6:32:58 PM2/22/10
to nod...@googlegroups.com
Thank you Ben!!! I was experiencing that bug two nights ago and was going crazy over it. After a good 30 minutes tracing variables I wrote my own deep copy method.


--

Benjamin Thomas

unread,
Feb 25, 2010, 2:58:48 AM2/25/10
to nod...@googlegroups.com
On Mon, Feb 22, 2010 at 9:39 AM, Avi Flax <a...@arc90.com> wrote:
> However, I'm still concerned by the dissonance between the HTTP spec
> and this API. The function being named "writeHeader" implies that it's
> for writing a HTTP header — but it's not. Another way to say this is
> that it implies that in HTTP there's a concept named "header" which
> includes the status code, reason phrase, and headers — but there
> isn't.
>
> I still think this should be changed. I got the impression in a
> previous thread that you were open to renaming the function. But if
> you've changed your mind, and you're sick of me asking about this,
> just say so and I'll drop it. If you're still open to it, I'd be happy
> to contribute a patch.

I think I agree with Avi here, and it is purely on a semantic note. I
think it should be called 'writeHead' as that would match nicely with
the HTTP HEAD method:

http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods

To save you the trouble if you are interested, I have attached a patch
which does precisely this.

--Benjamin

0001-Rename-writeHeader-to-writeHead.patch

Avi Flax

unread,
Feb 25, 2010, 10:54:59 AM2/25/10
to nod...@googlegroups.com
On Thu, Feb 25, 2010 at 02:58, Benjamin Thomas <bam.t...@gmail.com> wrote:

I think I agree with Avi here, and it is purely on a semantic note.  I
think it should be called 'writeHead' as that would match nicely with
the HTTP HEAD method:

Great suggestion, I really like it.
 
To save you the trouble if you are interested, I have attached a patch
which does precisely this.

Great patch!

Benjamin Thomas

unread,
Feb 25, 2010, 3:57:56 PM2/25/10
to nod...@googlegroups.com
I've updated the patch to properly merge with the test changes that
were just pushed.

I fully acknowledge that this is a bike-shedding issue. Seems like
now is the time to do it if you are considering it because the API is
already going through a lot of change anyway. Easier now than later.

0001-Rename-writeHeader-to-writeHead.patch

Ryan Dahl

unread,
Feb 25, 2010, 4:04:34 PM2/25/10
to nod...@googlegroups.com
On Thu, Feb 25, 2010 at 12:57 PM, Benjamin Thomas <bam.t...@gmail.com> wrote:
> I've updated the patch to properly merge with the test changes that
> were just pushed.
>
> I fully acknowledge that this is a bike-shedding issue.  Seems like
> now is the time to do it if you are considering it because the API is
> already going through a lot of change anyway.  Easier now than later.

I agree, it's a better name. I like saving the two characters. landed
in b1b84960cedcbc033b28c0644beada614b006a9b

Reply all
Reply to author
Forward
0 new messages