Skip to content

Stream goes into flowing mode immediately #66

Open
@LaurensRietveld

Description

@LaurensRietveld

We've experienced some odd issues that are probably caused by race conditions. I think it boils down to the stream going into flowing mode immediately

Afaik, the stream should only go into flowing mode when:

  • We attach an on-data listener
  • We pipe it to another writable stream
  • We explicitly call resume()

I would expect the below snippet to terminate fast and essentially be a no-op. In reality it isn't, and depending on the size of test.jsonld it will take a while for it to finish.

const fs = require("fs");
const { JsonLdParser } = require("./");
fs.createReadStream("./test.jsonld")
  .pipe(
    new JsonLdParser({
      baseIRI: "http://base"
    })
  )
  //Not registering an on-data listener, so not expecting this stream to start flowing
  //.on('data', () => {})

Would you agree with my observation with the stream going into flowing mode too quickly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions