Bachir Soussi Chiadmi ac58a24f5c added bower, gulp 7 years ago
..
LICENSE ac58a24f5c added bower, gulp 7 years ago
README.md ac58a24f5c added bower, gulp 7 years ago
index.js ac58a24f5c added bower, gulp 7 years ago
package.json ac58a24f5c added bower, gulp 7 years ago

README.md

detect-file NPM version NPM downloads Build Status

Detect if a filepath exists and resolves the full filepath.

Install

Install with npm:

$ npm install --save detect-file

Usage

var detect = require('detect-file');

API

detect

Resolve the given filepath if it exists.

Params

  • filepath {String}: filepath to detect.
  • options {Object}: Additional options.
  • options.nocase {Boolean}: Set this to true force case-insensitive filename checks. This is useful on case sensitive file systems.
  • returns {String}: Returns the resolved filepath if it exists, otherwise returns null.

Example

var res = detect('package.json');
console.log(res);
//=> "package.json"

var res = detect('fake-file.json');
console.log(res)
//=> null

Related projects

You might also be interested in these projects:

fs-exists-sync: Drop-in replacement for fs.existsSync with zero dependencies. Other libs I found either have crucial differences… more | homepage

Contributing

This document was generated by verb-readme-generator (a verb generator), please don't edit directly. Any changes to the readme must be made in .verb.md. See Building Docs.

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Or visit the verb-readme-generator project to submit bug reports or pull requests for the readme layout template.

Building docs

(This document was generated by verb-readme-generator (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

Generate readme and API documentation with verb:

$ npm install -g verb verb-readme-generator && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Brian Woodward

License

Copyright © 2016, Brian Woodward. Released under the MIT license.


This file was generated by verb, v0.9.0, on July 06, 2016.