Socket
Socket
Sign inDemoInstall

scandirectory

Package Overview
Dependencies
11
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    scandirectory

Scan a directory recursively with a lot of control and power


Version published
Maintainers
1
Install size
868 kB
Created

Changelog

Source

v2.5.0 2014 December 17

  • Extracted from balupton/bal-util
  • Changed accepted arguments

Readme

Source

scandirectory

Build Status NPM version NPM downloads Dependency Status Dev Dependency Status
Gratipay donate button Flattr donate button PayPayl donate button BitCoin donate button Wishlist browse button

Scan a directory recursively with a lot of control and power

Install

NPM

  • Use: require('scandirectory')
  • Install: npm install --save scandirectory

Usage

  • `scandir(path, opts, next?)``
  • `scandir(opts, next?)``

Options:

  • path: the path you want to read
  • action: (default null) can be null or a function to use for both the fileAction and dirAction
  • fileAction: (default null) can be null or a function to run against each file, in the following format:
    • `fileAction(fileFullPath, fileRelativePath, next(err,skip), fileStat)``
  • dirAction: (default null) can be null or a function to run against each directory, in the following format:
    • `dirAction(fileFullPath, fileRelativePath, next(err,skip), fileStat)``
  • next: (default null) can be null or a function to run after the entire directory has been scanned, in the following format:
    • `next(err, list, tree)``
  • stat: (default null) can be null or a file stat object for the path if we already have one (not actually used yet)
  • recurse: (default true) can be null or a boolean for whether or not to scan subdirectories too
  • readFiles: (default false) can be null or a boolean for whether or not we should read the file contents
  • ignorePaths: (default false) can be null or an array of paths that we should ignore
  • ignoreHiddenFiles: (default false) can be null or a boolean for if we should ignore files starting with a dot
  • ignoreCommonPatterns: (default false) can be null or a boolean or a regex
    • if null, becomes true
    • if false, does not do any ignore patterns
    • if true, defaults to bevry/ignorepatterns
    • if regex, uses this value instead of bevry/ignorepatterns
  • ignoreCustomPatterns: (default false) can be null or a boolean or a regex (same as ignoreCommonPatterns but for ignoreCustomPatterns instead)

Next Callback Arguments:

  • err: null, or an error that has occured
  • list: a collection of all the child nodes in a list/object format:
    • {fileRelativePath: 'dir|file'}
  • tree: a colleciton of all the child nodes in a tree format:
    • {dir: {dir:{}, file1:true} }
    • if the readFiles option is true, then files will be returned with their contents instead

Contribute

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

History

Discover the change history by heading on over to the HISTORY.md file.

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

No sponsors yet! Will you be the first?

Gratipay donate button Flattr donate button PayPayl donate button BitCoin donate button Wishlist browse button

Contributors

These amazing people have contributed code to this project:

Become a contributor!

License

Licensed under the incredibly permissive MIT license

Copyright © 2011+ Benjamin Lupton b@lupton.cc (http://balupton.com)
Copyright © 2014+ Bevry Pty Ltd us@bevry.me (http://bevry.me)

Keywords

FAQs

Last updated on 17 Dec 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc