Comments (5)
concat-stream isn't a readable stream, just a writable one. you can do this though:
process.stdin
.pipe(concat(function(buff) {
process.stdout.write(buff)
}))
from concat-stream.
Is there a reason why concat-stream
isn't readable? I would really benefit from that, instead of having to create a new readable from the output.
from concat-stream.
Yea, concat stream is the end-of-the-line for streaming data. It wouldn't
make sense to pipe it somewhere as it would only emit a single buffer,
hence the single callback API. Streams are for when you have a series of
chunks
On Tuesday, February 25, 2014, Karel Ledru-Mathé [email protected]
wrote:
Is there a reason why concat-stream isn't readable? I would really
benefit from that, instead of having to create a new readable from the
output.—
Reply to this email directly or view it on GitHubhttps://github.com/maxogden/concat-stream/issues/20#issuecomment-36062251
.
from concat-stream.
I understand your point. I guess it makes sense it most cases. Though here is my use case (I am new to streams).
I am writing a parser that extract pieces of informations recursively in all the files within a folder (and subfolders). Once all is parsed, I use concat-stream
to merge all the information in a single array.
Now let's say I want to create a gulp plugin out of this. I should return a stream so other plugin could pipe into my plugin. Right now, I should 'hack' it in the final callback.
from concat-stream.
I think being able to pipe the result of concat stream would make it more "composable". I actually have an use case where I want to either concat a stream into one big array or emit the chunks one at a time to another stream. Callback being the only API makes that a bit difficult.
update
Workaround I came up with.
stream-reduce = require 'stream-reduce'
# append :: a → [a] → [a]
{append, flip} = require 'ramda'
concat-stream = stream-reduce flip(append), []
stream
.pipe concat-stream
.on \data ->
# data [1,2]
stream.push 1
stream.push 2
stream.push null
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
- Convert to real stream HOT 4
- 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.