New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

count-files

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

count-files

count files in a directory recursively

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
487
decreased by-26.88%
Maintainers
1
Weekly downloads
 
Created
Source

Count Files

Count files, directories, and bytes in a directory recursively.

Ignore files in the count.

Usage

var countFiles = require('count-files')

countFiles(dir, function (err, stats) {
    // use stats
})

stats = {
  files: 100,
  dirs: 20,
  bytes: 234213
}

API

countFiles(dir, [opts], cb) { }

Callback returns a stats object: {files, dirs, bytes}.

Options include:

opts = {
  ignore: function (file) {
    return match(['**/*.js'], file) // return true to ignore file
  }
}

We find anymatch nice for ignoring files!

That's all folks!

Development

Some basic performance testing in tests/perf.js and alternate implementations in lib/. I think I chose the fastest but didn't test all situations!

License

ISC

FAQs

Package last updated on 20 Jan 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc