GithubHelp home page GithubHelp logo

zhaochy1990 / ignore-walk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from npm/ignore-walk

0.0 1.0 0.0 47 KB

Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.

License: ISC License

JavaScript 100.00%

ignore-walk's Introduction

ignore-walk

Build Status

Nested/recursive .gitignore/.npmignore parsing and filtering.

Walk a directory creating a list of entries, parsing any .ignore files met along the way to exclude files.

USAGE

const walk = require('ignore-walk')

// All options are optional, defaults provided.

// this function returns a promise, but you can also pass a cb
// if you like that approach better.
walk({
  path: '...', // root dir to start in. defaults to process.cwd()
  ignoreFiles: [ '.gitignore' ], // list of filenames. defaults to ['.ignore']
  includeEmpty: true|false, // true to include empty dirs, default false
  follow: true|false // true to follow symlink dirs, default false
}, callback)

// to walk synchronously, do it this way:
const result = walk.sync({ path: '/wow/such/filepath' })

If you want to get at the underlying classes, they're at walk.Walker and walk.WalkerSync.

OPTIONS

  • path The path to start in. Defaults to process.cwd()

  • ignoreFiles Filenames to treat as ignore files. The default is ['.ignore']. (This is where you'd put .gitignore or .npmignore or whatever.) If multiple ignore files are in a directory, then rules from each are applied in the order that the files are listed.

  • includeEmpty Set to true to include empty directories, assuming they are not excluded by any of the ignore rules. If not set, then this follows the standard git behavior of not including directories that are empty.

    Note: this will cause an empty directory to be included if it would contain an included entry, even if it would have otherwise been excluded itself.

    For example, given the rules * (ignore everything) and !/a/b/c (re-include the entry at /a/b/c), the directory /a/b will be included if it is empty.

  • follow Set to true to treat symbolically linked directories as directories, recursing into them. There is no handling for nested symlinks, so ELOOP errors can occur in some cases when using this option. Defaults to false.

ignore-walk's People

Contributors

isaacs avatar zhaochy1990 avatar

Watchers

 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.