Hey, there's an issue in the documentation, here's the patch:
--
From 0f10c69eee8dbffb71b1b6964afc5957b56a33b9 Mon Sep 17 00:00:00 2001 From: Micheil Smith <mich...@brandedcode.com> Date: Mon, 22 Feb 2010 20:53:51 +1100 Subject: [PATCH] Fixing a mistype in the documentation for fs.readdir & fs.readdirSync
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 nodejs@googlegroups.com. > To unsubscribe from this group, send email to nodejs+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
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.
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.
> -- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com. > To unsubscribe from this group, send email to > nodejs+unsubscribe@googlegroups.com<nodejs%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en.
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.
On Mon, Feb 22, 2010 at 1:48 PM, opichals <opich...@gmail.com> wrote: > 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
> > - Synchronous fs operations exposed, use with care.
> -- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com. > To unsubscribe from this group, send email to > nodejs+unsubscribe@googlegroups.com<nodejs%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en.
> On Mon, Feb 22, 2010 at 1:48 PM, opichals <opich...@gmail.com> wrote:
>> 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
>> > - Synchronous fs operations exposed, use with care.
>> -- >> You received this message because you are subscribed to the Google Groups >> "nodejs" group. >> To post to this group, send email to nodejs@googlegroups.com. >> To unsubscribe from this group, send email to >> nodejs+unsubscribe@googlegroups.com<nodejs%2Bunsubscribe@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en.
> -- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com. > To unsubscribe from this group, send email to > nodejs+unsubscribe@googlegroups.com<nodejs%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en.
On Mon, Feb 22, 2010 at 4:02 PM, Marak Squires <marak.squi...@gmail.com> wrote: > was process.mixing bugged at all? i was experiencing some odd behavior with > it the other day
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.
On Mon, Feb 22, 2010 at 6:25 PM, Benjamin Thomas <bam.tho...@gmail.com>wrote:
> On Mon, Feb 22, 2010 at 4:02 PM, Marak Squires <marak.squi...@gmail.com> > wrote: > > was process.mixing bugged at all? i was experiencing some odd behavior > with > > it the other day
> -- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com. > To unsubscribe from this group, send email to > nodejs+unsubscribe@googlegroups.com<nodejs%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en.
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:
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.
On Thu, Feb 25, 2010 at 12:58 AM, Benjamin Thomas <bam.tho...@gmail.com> wrote: > To save you the trouble if you are interested, I have attached a patch > which does precisely this.
On Thu, Feb 25, 2010 at 12:57 PM, Benjamin Thomas <bam.tho...@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