gulpjs understanding

Tuesday, February 17, 2015

I'm learning how to use gulpjs. From what I've been reading/watching on youtube. Gulp is a task runner like grunt except that it uses streams built on nodes stream api I have a few questions about the utility...

1. I've heard from several people that gulpjs is faster than grunt because it uses streams. I don't understand what the big benefit of streams is. I know it helps when you're processing very large files (parsing csv files) but for stuff like running unit tests or compiling sass files, I don't what the benefit is.

2. I'm finding it very hard to sniff the stream for raw data and running code against it. Here is an example. I want to write a test to see if a program is up or not...

var shell = require('gulp-shell');

.task('test', function() {

var task = shell.task(['boot2docker status']);
var stream = task();
.on('readable', function(a){
var chunk;
.log(JSON.stringify(a, null, 4));
while (null !== (chunk = {
.log('got %d bytes of data', chunk.length);
.log('data: ', chunk);

.on('data', function(a){
.on('end', function(){


I've tried a few different ways of trying to sniff the stream and this is the closest I've been. In all my attempts, I can get the stream object. But I just want to capture the output of the command and run an if condition on it. The bash command only returns a single line so it's really easy to check once I get it. But I can't get to it easily. Am I using streams in the wrong way? From what I read, stream api is based on the eventemitter built into node so it comes with events I can tap into. I know I'm doing this wrong but I don't know why.

3. is there a way to emit errors with proper exit codes so CI processes can catch errors? From what I've seen, people just do a console.log to output data but what if I make a custom task that I want to throw propper errors i.e. gulp knows it's an error, highlights it as an error and a CI environment like could see that and know something went wrong.

4. Theres the native node stream, buffers, file stream and vinyl. What is the difference between each, how do you know which one is being used in your task and why are there different stream types? Are there any sites that give a general breakdown of them? that is the closest thing I've found but it's way over my head.

-Thank you

You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit


Post a Comment

Note: Only a member of this blog may post a comment.

Copyright © 2010 Web Design | Free Blogger Templates by Splashy Templates | Layout by Atomic Website Templates

Vida de bombeiro Recipes Informatica Humor Jokes Mensagens Curiosity Saude Video Games Animals Diario das Mensagens Eletronica Rei Jesus News Noticias da TV Artesanato Esportes Noticias Atuais Games Pets Career Religion Recreation Business Education Autos Academics Style Television Programming Motosport Humor News The Games Home Downs World News Internet Design Entertaimment Celebrities 1001 Games Doctor Pets Net Downs World Enter Jesus Mensagensr Android Rub Letras Dialogue cosmetics Genexus lasofia thebushrajr wingshock tripedes gorduravegetal dainfamia dejavu-transpersonal jsbenfica republicadasbadanas ruiherbon iranianforaryans eaystcheyl fotosdanadir Só Humor Curiosity Gifs Medical Female American Health Madeira Designer PPS Divertidas Estate Travel Estate Writing Computer Matilde Ocultos Matilde futebolcomnoticias girassol lettheworldturn topdigitalnet Bem amado enjohnny produceideas foodasticos cronicasdoimaginario downloadsdegraca compactandoletras newcuriosidades blogdoarmario arrozinhoii