I know this code was here already, but why is the headWritten variable necessary? Couldn't you use the "readable" event (I'd rather call it start, but whatever) to do the initializing write?