stream.Duplex
See original GitHub issueIs there any technical reason this hasn’t been implemented as a stream.Duplex
? The first thing I wanted to do after downloading this module was device.pipe(protocol).pipe(application)
, just wondering if there are any technical reasons why this isn’t the case before I take a crack at converting it over.
My use case:
var hid = require('node-hid'),
Protocol = require('./Protocol'),
protocol = module.exports = new Protocol(),
devices = hid.devices();
devices
.filter(function (device) {
// filter devices down to those that match our interest
return device.vendorId === Protocol.VENDOR
&& device.productId === Protocol.PRODUCT;
})
.map(function (device) {
// map HID event emitter objects over devices
return new hid.HID(device.path);
})
.forEach(function (device) {
// pipe device data into protocol transformer
device.pipe(protocol);
});
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Creating Duplex streams in Node.js - LogRocket Blog
Duplex streams, on the other hand, are a mixture of both the readable and writable streams where both streams are independent of each...
Read more >Stream | Node.js v19.3.0 Documentation
Duplex and Transform streams are both Writable and Readable . Applications that are either writing data to or consuming data from a stream...
Read more >How to create a Duplex stream in nodejs? - Stack Overflow
The nodejs Duplex stream requires the implementer to specify both a write and a read method: import stream from 'stream'; const duplex =...
Read more >Watch Duplex | Prime Video - Amazon.com
HD. A tempestuous tenant drives couple Ben Stiller and Drew Barrymore to the point of murder in this dark comedy. Directors: Danny DeVito....
Read more >duplex-stream in javascript - liveBook · Manning
The great thing about duplex streams is they can sit in the middle of pipes. A simpler way to do this is to...
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
Hi @bathos, Yes, if you want to do a PR with the README warning, that would be awesome. I know nothing of stream.Duplex yet but I’d be amenable to adding it. node-hid’s was written before existed I think and I have no objection to adding to its API to make it work in a more modern way.
I’m all for improving docs, but maybe we should change node-hid to implement the Duplex stream?