npm / fstream

Advanced FS Streaming for Node
ISC License
208 stars 43 forks source link

Filtering before piping? #7

Closed bebraw closed 11 years ago

bebraw commented 12 years ago

Would it be feasible to implement something like this?

fstream
  .Reader("path/to/dir")
  .exclude('^.', 'foo.html')
  .pipe(fstream.Writer("path/to/other/dir"))

I want to copy certain files instead of all. The example skips all the dot files and a certain other file.

aeosynth commented 11 years ago

you should probably use node-glob to select

isaacs commented 11 years ago

How about this?

fstream.Reader({ path: "path/to/dir", filter: function (entry) {
  return entry.match(someRegexp)
} }).pipe(fstream.Writer("path/to/other/dir"))