Initial commit
[yaffs-website] / node_modules / detect-file / README.md
1 # detect-file [![NPM version](https://img.shields.io/npm/v/detect-file.svg?style=flat)](https://www.npmjs.com/package/detect-file) [![NPM downloads](https://img.shields.io/npm/dm/detect-file.svg?style=flat)](https://npmjs.org/package/detect-file) [![Build Status](https://img.shields.io/travis/doowb/detect-file.svg?style=flat)](https://travis-ci.org/doowb/detect-file)
2
3 Detect if a filepath exists and resolves the full filepath.
4
5 ## Install
6
7 Install with [npm](https://www.npmjs.com/):
8
9 ```sh
10 $ npm install --save detect-file
11 ```
12
13 ## Usage
14
15 ```js
16 var detect = require('detect-file');
17 ```
18
19 ## API
20
21 ### [detect](index.js#L34)
22
23 Resolve the given `filepath` if it exists.
24
25 **Params**
26
27 * `filepath` **{String}**: filepath to detect.
28 * `options` **{Object}**: Additional options.
29 * `options.nocase` **{Boolean}**: Set this to `true` force case-insensitive filename checks. This is useful on case sensitive file systems.
30 * `returns` **{String}**: Returns the resolved filepath if it exists, otherwise returns `null`.
31
32 **Example**
33
34 ```js
35 var res = detect('package.json');
36 console.log(res);
37 //=> "package.json"
38
39 var res = detect('fake-file.json');
40 console.log(res)
41 //=> null
42 ```
43
44 ## Related projects
45
46 You might also be interested in these projects:
47
48 [fs-exists-sync](https://www.npmjs.com/package/fs-exists-sync): Drop-in replacement for `fs.existsSync` with zero dependencies. Other libs I found either have crucial differences… [more](https://github.com/jonschlinkert/fs-exists-sync) | [homepage](https://github.com/jonschlinkert/fs-exists-sync "Drop-in replacement for `fs.existsSync` with zero dependencies. Other libs I found either have crucial differences from fs.existsSync, or unnecessary dependencies. See README.md for more info.")
49
50 ## Contributing
51
52 This document was generated by [verb-readme-generator](https://github.com/verbose/verb-readme-generator) (a [verb](https://github.com/verbose/verb) generator), please don't edit directly. Any changes to the readme must be made in [.verb.md](.verb.md). See [Building Docs](#building-docs).
53
54 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
55
56 Or visit the [verb-readme-generator](https://github.com/verbose/verb-readme-generator) project to submit bug reports or pull requests for the readme layout template.
57
58 ## Building docs
59
60 _(This document was generated by [verb-readme-generator](https://github.com/verbose/verb-readme-generator) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
61
62 Generate readme and API documentation with [verb](https://github.com/verbose/verb):
63
64 ```sh
65 $ npm install -g verb verb-readme-generator && verb
66 ```
67
68 ## Running tests
69
70 Install dev dependencies:
71
72 ```sh
73 $ npm install -d && npm test
74 ```
75
76 ## Author
77
78 **Brian Woodward**
79
80 * [github/doowb](https://github.com/doowb)
81 * [twitter/doowb](http://twitter.com/doowb)
82
83 ## License
84
85 Copyright Â© 2016, [Brian Woodward](https://github.com/doowb).
86 Released under the [MIT license](https://github.com/doowb/detect-file/blob/master/LICENSE).
87
88 ***
89
90 _This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on July 06, 2016._