On the writable end, I push a `JSON.stringify`d object.
On the other reader end, can I expect `chunk` to be `JSON.parse` -able?

When running the code below, it seems like it.  Like, it works and I can't 
logically make sense of it.  I would expect that if not in objectMode, the 
reader will need to buffer things until some sentinel pattern is found 
which will tell me it's safe to call JSON.parse.

Could someone shed some light on why this works and if I can rely on this 
in practice?

```
var Readable = require('stream').Readable;
var Transform = require('stream').Transform

printer = new Transform()
printer._transform = function (chunk, enc, next) {
  console.log(JSON.parse(chunk)) // <- safe to assume I can JSON.parse this?
  this.push(chunk)
  next()
}

var rs = new Readable
rs.push(JSON.stringify({foo: 'bar'}))
rs.push(JSON.stringify({foo: 'bar'}))
rs.push(JSON.stringify({foo: 'bar'}))
rs.push(null)

rs.pipe(printer)

```

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to