Skip to content

createWriteStream writes whitespace instead of data #121

Closed Answered by uhop
ronnlixx asked this question in Q&A
Discussion options

You must be logged in to vote

Your code fragment looks legit, but the devil is in the details. Let me annotate it with a type of stream produced by every stage of the pipeline:

const pipeline = chain([
  fs.createReadStream('./data/sample.json'), // TEXT
  parser(), // TOKEN
  pick({filter: 'DataSet.Table'}), // TOKEN
  streamArray(), // OBJECT
  data => // OBJECT
    data.value.EmailAddress && data.value.CustomerStatus === 'Active'
      ? data.value
      : null,
  stringer(), // TEXT
  fs.createWriteStream('./data/updated-sample.json')
]);

Now comes the question: what kind of stream is expected by stringer()? It is a trick question because the library provides two stringers:

  • stringer() of stream-json/Stringer expe…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by uhop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants