dominictarr / JSONStream

rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)
Other
1.92k stars 165 forks source link

missing stream.unpipe method #48

Closed PavelVanecek closed 6 years ago

PavelVanecek commented 9 years ago

Hi,

I'm trying to .unpipe a JSONStream.

My code:

var fs = require('fs')
var stream = require('JSONStream').parse()
fs.createReadStream('package.json').pipe(stream)
stream.pipe(process.stdout)
stream.unpipe(process.stdout)

Expected result: nothing (the stream is not piped anywhere else)

Actual result:

TypeError: Object #<Stream> has no method 'unpipe'
dominictarr commented 9 years ago

that is because this is a streams1 stream. if you really want a streams2 one, you could use http://nodejs.org/api/stream.html#stream_readable_wrap_stream