Comments (4)
Using the builtin .pipe
doesn't propagate error
events, so you would still need to either handle .on('error'
yourself in the downstream streams or use something like require('pump')
that does it for you.
My personal philosophy of streams is that they should be used for streaming efficient pieces of data, so I'm 👎 on a stream that uses the data
event to emit a huge concatenated buffer.
Maybe a good module idea would be to combine pump
and concat-stream
into a module that had an API like this:
var pumpcat = require('pumpcat')
pumpcat(readableStream, throughStream, function done (err, data) {
// err is from `pump`
// `data` is from concat-stream
})
from concat-stream.
Using the builtin .pipe doesn't propagate error events, so you would still need to either handle .on('error' yourself in the downstream streams or use something like require('pump') that does it for you.
Oh, I believed errors where propagated over all the pipeline, so it was only needed to listed to them on the last element. Is not this the case? :-(
My personal philosophy of streams is that they should be used for streaming efficient pieces of data, so I'm 👎 on a stream that uses the data event to emit a huge concatenated buffer.
This point has some perspectives, and they are not incompatible :-) I find myself acceptable to emit a single big data
event when dealing with pure-stream app architectures. Another valid style would be to return a Promise instead of using a callback, and I think both three would be allowed to be used at the same time, just apply the callback on the promise and dispatch this last one on the single data
event :-)
Maybe a good module idea would be to combine pump and concat-stream into a module that had an API like this:
var pumpcat = require('pumpcat')
pumpcat(readableStream, throughStream, function done (err, data) {
// err is frompump
//data
is from concat-stream
})
I'm not too much into thought
module (I like to use directly the stream API), but yes, I like the module API you've proposed :-)
from concat-stream.
Oh, I believed errors where propagated over all the pipeline, so it was only needed to listed to them on the last element. Is not this the case? :-(
yes unfortunately you have to handle errors on each stream in the pipeline yourself. however if you use something like pump
it implements error propagation for you so you can handle it with a single callback
from concat-stream.
@maxogden hm, i had to do pump + bl quite a few times, and also bumped into this thread. here it is - https://github.com/aks-/pumpcat
from concat-stream.
Related Issues (20)
- Same functionality as accum? HOT 10
- Publish 1.4.5 to npm
- git tags HOT 2
- Stream empty for concatenated passthrough streams HOT 2
- concat-stream - buffer object in callback is empty. HOT 4
- handling errors HOT 1
- CI HOT 2
- Use standard, error-first callbacks HOT 4
- introduce Readable and Duplex concat streams HOT 1
- Use end-of-stream to determine end
- Bump readable-stream version to 2.1.x HOT 1
- Callback never fired if read stream emits an error HOT 2
- Security Vulnerability HOT 2
- Buffer Overhead Vulnerability HOT 2
- Buffer overread vulnerability HOT 2
- Buffer constructor runtime deprecation - this package emits a warning on Node 10
- How big is the difference from 1.6.* to 2.* ? HOT 3
- Is this package still maintained? HOT 1
- Stream consumers: Alternative builtin nodejs solution
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from concat-stream.