Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from2 doesn't work without through2 #7

Open
tamtakoe opened this issue Jan 25, 2015 · 1 comment
Open

from2 doesn't work without through2 #7

tamtakoe opened this issue Jan 25, 2015 · 1 comment

Comments

@tamtakoe
Copy link

I try it and get infinite loop in headStream

var headStream = from2.obj(function (size, next) {
    var file = new File({
        path: 'head.js',
        contents: new Buffer('head content')
    });
    next(null, file);
})

series(headStream, otherStream)
    .pipe(g.concat(name))
    .pipe(gulp.dest(destPath))

I try it and get 16 loops (size = 16), but head file doesn't write to output file

var flag = false;
var headStream = from2.obj(function (size, next) {
    if (flag) return this.push(null);
    ...
    flag = true;
    next(null, file);
})
...

If I use through it works!

var headStream = from2.obj(function (size, next) {
    ...
    this.push(file)
    next();
})
.pipe(through2.obj(function (file, enc, callback) {
    callback(null, file);
}));
...

Why? And how to do it without through?

@mafintosh
Copy link
Collaborator

could you provide a simple runnable test case that doesn't use gulp to showcase this error? then it might be easier to pinpoint what is wrong :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants