jsonexport icon indicating copy to clipboard operation
jsonexport copied to clipboard

Stream does not support typeHandlers option

Open setheal opened this issue 3 years ago • 3 comments

Hello,

I'm currently using the version 3.2.0 with the stream mode and apparently it's not possible to pass the typeHandlers options.

I checked a bit the code and I think the issue is located here : https://github.com/kaue/jsonexport/blob/4a498777bab79dac88d32515b7ebd2086d8c6f41/lib/index.js#L56

setheal avatar Sep 20 '21 09:09 setheal

A recommendation for more details as to what you are trying to accomplish and how you are trying to accomplish that.

I'm not able to connect enough dots with the information provided. I do assume you are trying to pass in individual typeHandlers but I can't related that to the coded provided.

If you do perhaps understand there is an issue and room for improvement, perhaps make a PR to better illustrate what's wrong and needing fixed

AckerApple avatar Sep 20 '21 13:09 AckerApple

Yes, sorry for that.

I'm getting a stream of json data from a database and I want to transform a bit the CSV output.

I tried this to check how it was working :

esStream.pipe(
    jsonexport({
      typeHandlers: {
        Object: (value) => {
          return 'test';
        }
      },
      rename: schema.list.displayed.map(
        (property) => property[language] || property.en
      )
    })
  )
    .pipe(res);

But I got this error TypeError: dest.on is not a function. I tried the version 2.5.2 and it's working fine on this version.

setheal avatar Sep 21 '21 08:09 setheal

I get this error just for passing options to jsonexport when using stream. Doesn't matter which options you have. Im using 3.2.0

jaichandra avatar Aug 26 '22 20:08 jaichandra