Giter Site home page Giter Site logo

dir-glob's Introduction

dir-glob Build Status

Convert directories to glob compatible strings

Install

$ npm install dir-glob

Usage

const dirGlob = require('dir-glob');

dirGlob(['index.js', 'test.js', 'fixtures']).then(files => {
	console.log(files);
	//=> ['index.js', 'test.js', 'fixtures/**']
});

dirGlob(['index.js', 'inner_folder'], {
	cwd: 'fixtures'
}).then(files => {
	console.log(files);
	//=> ['index.js', 'inner_folder/**']
});

dirGlob(['lib/**', 'fixtures'], {
	files: ['test', 'unicorn']
	extensions: ['js']
}).then(files => {
	console.log(files);
	//=> ['lib/**', 'fixtures/**/test.js', 'fixtures/**/unicorn.js']
});

dirGlob(['lib/**', 'fixtures'], {
	files: ['test', 'unicorn', '*.jsx'],
	extensions: ['js', 'png']
}).then(files => {
	console.log(files);
	//=> ['lib/**', 'fixtures/**/test.{js,png}', 'fixtures/**/unicorn.{js,png}', 'fixtures/**/*.jsx']
});

API

dirGlob(input, [options])

Returns a Promise for an array of glob strings.

dirGlob.sync(input, [options])

Returns an array of glob strings.

input

Type: Array string

A string or an Array of paths.

options

extensions

Type: Array

Append extensions to the end of your globs.

files

Type: Array

Only glob for certain files.

cwd

Type: string

Test in specific directory.

License

MIT © Kevin Mårtensson

dir-glob's People

Contributors

kevva avatar sgtlambda avatar termosa avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.