mafintosh / hyperdb

Distributed scalable database
MIT License
752 stars 75 forks source link

createReadStream throws error if destroyed within a transform stream. #73

Closed e-e-e closed 6 years ago

e-e-e commented 6 years ago

I get the following error when destroying stream created via createReadStream.

 Uncaught TypeError: cb is not a function
      at nextDone (node_modules/nanoiterator/index.js:70:3)
      at _combinedTickCallback (internal/process/next_tick.js:83:11)
      at process._tickCallback (internal/process/next_tick.js:104:9)

This transform stream causes the issue: https://github.com/e-e-e/hyper-graph-db/blob/master/lib/HyperdbReadTransform.js I can avoid the error if I end the stream via this.end() and move the call to stream.destroy to the _flush function.

mafintosh commented 6 years ago

This is fixed