Skip to content

pull-stream/pull-glob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pull-glob

streaming extended glob.

use with pull-stream

examples

var pull = require('pull-stream')
var glob = require('pull-glob')

glob('.')      .pipe(log()) // current dir
glob('*.js')   .pipe(log()) // current dir
glob('**')     .pipe(log()) // everything under current dir
glob('**/*.js').pipe(log()) // .js recursively
glob('...')    .pipe(log()) // parent directories
glob('.../.*') .pipe(log()) // hidden files
glob('.../node_modules/*')
                .pipe(log()) // available modules!
glob('.../{package,component}.json')
                .pipe(log()) // search for local package files.

function log () {
  return pull.drain(console.log)
}

stopping early

because this module uses pull-streams, it's lazy, so you can do queries like the following:

//find the first package.json in a parent directory.
glob('.../package.json').pipe(pull.take(1)).pipe(log())

And you will retrive only the first item, and will not do any extra IO. This is hugely useful when doing a large traversal...

collect node_module tree

glob('**/node_modules/*/package.json')
  .pipe(pull.collect(function (e, arr) {
    console.log(arr)
  })

License

MIT

About

streaming extended glob

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published