mholt/PapaParse

Nodejs stream - support object mode

Open

#652 aberto em 1 de abr. de 2019

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)JavaScript (1.157 forks)batch import
help wantednodejs support

Métricas do repositório

Stars
 (11.877 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

Upon further research, https://github.com/mholt/PapaParse/issues/568 indicates unparse does not support streaming at all.

The documentation for Nodejs stream support seems a bit limited and I'm not able to get it working in object mode. I'm getting an error when I attempt the following. Is object mode streaming supported?

Unable to serialize unrecognized input

const readable = new Readable({ objectMode: true, highWaterMark: 10000 })

// ...

const parser = Papa.unparse(Papa.NODE_STREAM_INPUT, {
  fastMode: true
});

pipeline(
  readable,
  through2.obj(function p(chunk, enc, cb) {
  // do stuff with data
  // chunk is a js object
    cb(null, chunk);
  }),
  parser,
  res
);

Guia do colaborador