checkdir

1.1.0 • Public • Published

checkdir

NPM version Build Status Dependency Status

Check if dir exists, if it's empty and how many files are directly inside it.

Install

$ npm install checkdir

Usage

var checkdir = require('checkdir');
 
checkdir('/some/test/dir').then(info => console.log(info));
//=> {
//    empty: false,
//    exists: true,
//    files: 1
// }
 
// or assuming that the only file in the dir is a 'dotfile'
checkdir('/some/test/dir', { ignoreDotFiles: true })
  .then(info => console.log(info));
//=> {
//    empty: true,
//    exists: true,
//    files: 0
// }

API

checkdir(directoryPath)

directoryPath

Required Type: String

Path to directory.

options

ignoreDotFiles

Type: Boolean (Default: false)

Don't count files/folders that begin with the dot ('.') character, e.g.. '.git' or '.gitignore'.

License

MIT © DaveJ

Readme

Keywords

none

Package Sidebar

Install

npm i checkdir

Weekly Downloads

1

Version

1.1.0

License

MIT

Last publish

Collaborators

  • davej