You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.3 KiB

4 years ago
  1. # is-directory [![NPM version](https://img.shields.io/npm/v/is-directory.svg?style=flat)](https://www.npmjs.com/package/is-directory) [![NPM downloads](https://img.shields.io/npm/dm/is-directory.svg?style=flat)](https://npmjs.org/package/is-directory) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-directory.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-directory)
  2. Returns true if a filepath exists on the file system and it's directory.
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/):
  5. ```sh
  6. $ npm install is-directory --save
  7. ```
  8. ## Usage
  9. ```js
  10. var isDirectory = require('is-directory');
  11. isDirectory('node_modules', function(err, dir) {
  12. if (err) throw err;
  13. console.log(dir);
  14. //=> true
  15. });
  16. isDirectory.sync('README.md');
  17. //=> false
  18. ```
  19. ## Related projects
  20. You might also be interested in these projects:
  21. * [is-absolute](https://www.npmjs.com/package/is-absolute): Polyfill for node.js `path.isAbolute`. Returns true if a file path is absolute. | [homepage](https://github.com/jonschlinkert/is-absolute)
  22. * [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern.… [more](https://www.npmjs.com/package/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob)
  23. * [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative)
  24. ## Contributing
  25. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-directory/issues/new).
  26. ## Building docs
  27. Generate readme and API documentation with [verb](https://github.com/verbose/verb):
  28. ```sh
  29. $ npm install verb && npm run docs
  30. ```
  31. Or, if [verb](https://github.com/verbose/verb) is installed globally:
  32. ```sh
  33. $ verb
  34. ```
  35. ## Running tests
  36. Install dev dependencies:
  37. ```sh
  38. $ npm install -d && npm test
  39. ```
  40. ## Author
  41. **Jon Schlinkert**
  42. * [github/jonschlinkert](https://github.com/jonschlinkert)
  43. * [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
  44. ## License
  45. Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
  46. Released under the [MIT license](https://github.com/jonschlinkert/is-directory/blob/master/LICENSE).
  47. ***
  48. _This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 21, 2016._