caolan / highland

High-level streams library for Node.js and the browser

Home Page:https://caolan.github.io/highland

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2.13.1 doesn't play with JSONStream

amsross opened this issue · comments

Here is some example code:

const { parse } = require('JSONStream')
const h = require('highland')

h.log('start')
h.of(JSON.stringify({ 'foo': 'bar' }))
  .through(parse())
  .done(() => h.log('done'))

With the following versions, this code logs "start", then exits:

  • highland@2.13.1
  • JSONStream@1.3.5

With the following versions, this code logs "start", then "done", then exits:

  • highland@2.13.0
  • JSONStream@1.3.5

Further testing is needed on my part to expose some useful details, but I think this is worth opening as-is for the time being.

Sorry about this. The fix for #670 caused some collateral damage. through used to pause the target stream. The fix stopped doing that to fix an incompatibility with node 0.10, but caused this a regression.

Basically, through is implemented in terms of pipe. In 2.x, pipe can synchronously push data through, which can cause data loss if the through stream is un-paused. I will update pipe so that it always pushes data asynchronously.

This should be fixed in 2.13.3.

Awesome, thanks for the quick response!