help with highland configurable consumer
See original GitHub issueI have thee following code with a file test.info
containing some numbers each on their own line. I expect this to output a series of lines Doubled =
then the doubled number. Instead I’m getting the error that follows. It is a little funky, I admit, but I am working with some legacy code and want to be able to conditionally swap in a highland based consumer, so can’t switch it all out to highland. Any ideas? (Is there a better spot for questions like these? Slack? IRC?)
const _ = require('highland');
const fs = require('fs');
const Pump = require('util').promisify(require('stream').pipeline);
const double = x => x*2;
const consumer = _.curry(({ func, msg }, data) => _(data)
.map(func)
.each(x => console.log(msg, x))
.done(()=> console.log('done consuming...'))
);
const main = async () => {
const fileStream = fs.createReadStream('test.info');
const publisher = consumer({func: double, msg: 'Doubled = '});
await Pump(fileStream, publisher);
console.log('DONE');
};
main();
(node:42596) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'on' of undefined
at destroyer (internal/streams/pipeline.js:23:10)
at internal/streams/pipeline.js:78:12
at Array.map (<anonymous>)
at pipeline (internal/streams/pipeline.js:75:28)
at internal/util.js:278:30
at new Promise (<anonymous>)
at pipeline (internal/util.js:277:12)
at main (/Users/jdietrich/work/ipsis-standardcsv/src/test.js:18:11)
at Object.<anonymous> (/Users/jdietrich/work/ipsis-standardcsv/src/test.js:23:1)
at Module._compile (internal/modules/cjs/loader.js:959:30)
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Configuration Analyst job in Salem, Oregon, US
Apply for Configuration Analyst job with North Highland in Salem, Oregon, US. Browse and apply for the Process and Business Analysis jobs at ......
Read more >Highland Chicago - Facebook
Highland Chicago, Chicago, Illinois. 187 likes · 1 talking about this. We're a digital product consultancy with a fierce commitment to keeping people...
Read more >Configuration Analyst - North Highland - LinkedIn
The configuration analyst will be responsible for modifying Consumer-Off-the-Shelf (COTS) content using tools built into the software (i.e. no “coding”).
Read more >Highland Client Reviews | Clutch.co
Highland worked with Thrivent Financial to build Fulfill, a streamlined application to help Gen-Z and millennial bankers make the most of their money....
Read more >Integration Tests for Kafka Consumer - Better Programming
Recently, I wrote a comprehensive tutorial on how to build an event-driven application with Kafka and DynamoDB. The tutorial covers the end-to-end of ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The CI helped prove that solution will not work on versions before node 14.
https://github.com/eccentric-j/highland-pipline-repro/actions/runs/144114428
The most straight forward solution that works with all 3 node versions:
https://github.com/eccentric-j/highland-pipline-repro/actions/runs/144122089
Finally, there’s a solution that works about the way you intended it:
Which does work on the last 3 node versions as well https://github.com/eccentric-j/highland-pipline-repro/actions/runs/144206922
Thank you!