Source code to accompany my book, "Learning Node.JS". Every once in a while, I'll update to the latest version of Node.JS and let everybody know if there are any changes or updates required to the code (and will make those changes in the source tree).
As devastating as it is to admit, there are a couple of errors in the book. Those responsible for these egregious violations of editorial process (me) have been shot.
p117. At the top of p117, you can change d.toString("utf8")
to d
Or you could just replace the following:
if (d) {
if (typeof d == 'string')
res.write(d);
else if (typeof d == 'object' && d instanceof Buffer)
res.write(d.toString("utf8"));
}
with:
if (d)
res.write(d);
(note that all the other samples in this chapter got it right, just sample 2 has this)
p176. At the top of the page, the .sort("date")
should read .sort(sort)
p249. There are two lines of the format:
var data = process.stdXXX.read();
These should read:
var data = node.stdXXX.read();