Skip to content Skip to sidebar Skip to footer

How Can I Properly Implement The Nodejs Stream Api?

I've got a piece of an application that reads input sometimes from a file, sometimes over a socket, and sometimes from another part of the same program which produces a buffer or a

Solution 1:

The answer is: somewhere you call something like this:

var end = response.end; response.end = function() { end() }

Instead of something like this:

var end = response.end; response.end = function() { response.end = end; response.end() }

You see? The context is different: in the first case you call it with 'this === global', but there is no global._implicitHeader function, and in the second case you call it with 'this === response', and there is response._implicitHeader function.

Post a Comment for "How Can I Properly Implement The Nodejs Stream Api?"