tomas / needle

Nimble, streamable HTTP client for Node.js. With proxy, iconv, cookie, deflate & multipart support.

Home Page:https://www.npmjs.com/package/needle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stream does not emit 'done' event when data is over

dualitysol opened this issue · comments

The stream throws only chunks, no 'done' event

needle.get(url, { parse: true })
.pipe(new JSONStream.parse(${entryField}.*))
.on('data', syncDocument) // aply sync function
.on('done', (err, _) => {
console.log('DONEEEE')
if (err) return err

      this.closeConnection() // closing connection to db
        .then(() => console.log('done!'))
    })

I see chunks, everything is fine, but on('done') was never emitted...

Sorry, actually stream was with incorrect data inside to parse as json...