node.js - Detecting end of stream on streams2 -
node.js - Detecting end of stream on streams2 -
i read if stream uses 'data'
or 'end'
listeners switches "classic" mode , stream-handbook says:
note whenever register "data" listener, set stream compatability mode lose benefits of new streams2 api
so what's best way utilize benefits of new streams api? if i'm doing this:
gulp.src(["./src/server/**/*.coffee"]) .pipe(coffee bare: true ).on("error", gutil.log) .pipe(gulp.dest "./bin/server") .on 'end',-> gutil.log "successfully compiled server coffeescript"
how can same thing without registering 'end'
listener
only calling .resume()
/.pause()
or adding 'data' listener switch streams2 stream streams1 stream. can hear 'end' without affecting anything.
in particular example, if did switch not impact since piping, works in both streams1 , streams2 modes.
additionally, may not see 'end' event if lastly stream (gulp.dest "./bin/server"
) not duplex stream or not consume info it. if writable stream, should hear 'finish' instead ('end' emitted on readable streams).
node.js coffeescript gulp node.js-stream
Comments
Post a Comment