sindresorhus / gulp-filter

Filter files in a `vinyl` stream
MIT License
315 stars 37 forks source link

buffering all files and the `.end()` event could easily cause excessive memory use #3

Closed robrich closed 10 years ago

robrich commented 10 years ago

This also seems to break the "plugin should do one thing" rule.

cc: @contra, @phated

phated commented 10 years ago

@robrich can you explain this better?

robrich commented 10 years ago

Perhaps "leak" is not the best term. Perhaps better said "excessive memory use."

A plugin should take an input file, do something, and return a result. Collecting all files and doing something at the end is really bad form. The only good use-case I can see is concat(), but even then, use require such that you don't need to.

yocontra commented 10 years ago

@robrich for plugins that need to operate on all files (mocha, concat, etc.) this is fine

phated commented 10 years ago

I think this is fine. Am I correct in my assumption that through2 is just causing artificial backpressure in this instance?