question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I prepend a stream to another?

See original GitHub issue

Hi!

I’m still getting used to gulp’s processing model and it’s not entirely clear to me how to achieve something like this:

src1 | filter concat src2 | filter > output

The recipe here results in an unordered stream, but I’d like concat to be really concat and not just merge chucks arbitrarily.

Thanks!

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
darsaincommented, Feb 8, 2014

Shit. I forgot an option flag 😃 You need to specify { objectMode: true }:

var gulp = require('gulp');
var concat = require('gulp-concat');
var streamqueue = require('streamqueue');

gulp.task('default', function () {
    return streamqueue({ objectMode: true },
        gulp.src('foo/*'),
        gulp.src('bar/*')
    )
        .pipe(concat('result.txt'))
        .pipe(gulp.dest('build'));
});

// ... or ...

gulp.task('default', function () {
    var stream = streamqueue({ objectMode: true });
    stream.queue(gulp.src('foo/*'));
    stream.queue(gulp.src('bar/*'));
    return stream.done()
        .pipe(concat('result.txt'))
        .pipe(gulp.dest('build'));
});
0reactions
chrismarxcommented, Feb 11, 2016

+1 for objectMode, that’s critical!

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - How do I prepend a Stream? - Stack Overflow
This leads to two options: write in an opening tag into the memorystream prior to loading the blobs; create a second memorystream, write...
Read more >
Append or Prepend Items to a Stream - HowToDoInJava
To prepend the items at the end of a Stream, create a new stream of the items and pass the new Stream as...
Read more >
How to Add a Single Element to a Stream in Java - Baeldung
One approach is to use a terminal operation to collect the values of the stream to an ArrayList, and then simply use add(int...
Read more >
prepend - Documentation - Akka
The `prepend` operator is for backwards compatibility reasons "detached" and ... demand an element from both upstreams when the stream is materialized and ......
Read more >
stream_filter_prepend - Manual - PHP
When a new filter is prepended to a stream, data in the internal buffers, which has already been processed through other filters will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found