{"_id":"detect-file","_rev":"27012","name":"detect-file","description":"Detects if a file exists and returns the resolved filepath.","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"doowb","email":""},{"name":"jonschlinkert","email":""}],"time":{"modified":"2023-03-24T16:59:34.000Z","created":"2016-07-06T21:49:09.925Z","1.0.0":"2017-08-06T03:09:20.319Z","0.1.0":"2016-07-06T21:49:09.925Z"},"users":{},"author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/detect-file.git"},"versions":{"1.0.0":{"name":"detect-file","description":"Detects if a file exists and returns the resolved filepath.","version":"1.0.0","homepage":"https://github.com/doowb/detect-file","author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/detect-file.git"},"bugs":{"url":"https://github.com/doowb/detect-file/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{},"devDependencies":{"gulp-format-md":"*","mocha":"*"},"keywords":["detect","exists","file","file exists","file-path","filepath","path","resolve","resolve file","resolve filepath"],"verb":{"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["fs-exists-sync"]},"reflinks":["verb","verb-readme-generator"],"lint":{"reflinks":true}},"gitHead":"9454484372bf7f49cc9eecf4324d1f918f698e96","_id":"detect-file@1.0.0","_shasum":"f0d66d03672a825cb1b73bdb3fe62310c8e552b7","_from":".","_npmVersion":"4.6.1","_nodeVersion":"6.10.1","_npmUser":{"name":"doowb","email":"brian.woodward@gmail.com"},"dist":{"shasum":"f0d66d03672a825cb1b73bdb3fe62310c8e552b7","size":3413,"noattachment":false,"key":"/detect-file/-/detect-file-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/detect-file/download/detect-file-1.0.0.tgz"},"maintainers":[{"name":"doowb","email":""},{"name":"jonschlinkert","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-file-1.0.0.tgz_1501988960217_0.8393025605473667"},"directories":{},"publish_time":1501988960319,"_hasShrinkwrap":false,"_cnpm_publish_time":1501988960319},"0.1.0":{"name":"detect-file","description":"Detect if a filepath exists and resolves the full filepath.","version":"0.1.0","homepage":"https://github.com/doowb/detect-file","author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/detect-file.git"},"bugs":{"url":"https://github.com/doowb/detect-file/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"fs-exists-sync":"^0.1.0"},"devDependencies":{"gulp-format-md":"*","mocha":"*"},"keywords":[],"verb":{"layout":"default","plugins":["gulp-format-md"],"related":{"list":["fs-exists-sync"]},"reflinks":["verb","verb-readme-generator"]},"gitHead":"0e4111c071470ce4be0804c01a0248331418f8c6","_id":"detect-file@0.1.0","_shasum":"4935dedfd9488648e006b0129566e9386711ea63","_from":".","_npmVersion":"3.7.5","_nodeVersion":"5.1.1","_npmUser":{"name":"doowb","email":"brian.woodward@gmail.com"},"dist":{"shasum":"4935dedfd9488648e006b0129566e9386711ea63","size":3155,"noattachment":false,"key":"/detect-file/-/detect-file-0.1.0.tgz","tarball":"http://name.csiicloud.com:7001/detect-file/download/detect-file-0.1.0.tgz"},"maintainers":[{"name":"doowb","email":""},{"name":"jonschlinkert","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/detect-file-0.1.0.tgz_1467841748733_0.7613796112127602"},"directories":{},"publish_time":1467841749925,"_cnpm_publish_time":1467841749925,"_hasShrinkwrap":false}},"readme":"# detect-file [![NPM version](https://img.shields.io/npm/v/detect-file.svg?style=flat)](https://www.npmjs.com/package/detect-file) [![NPM monthly downloads](https://img.shields.io/npm/dm/detect-file.svg?style=flat)](https://npmjs.org/package/detect-file)  [![NPM total downloads](https://img.shields.io/npm/dt/detect-file.svg?style=flat)](https://npmjs.org/package/detect-file) [![Linux Build Status](https://img.shields.io/travis/doowb/detect-file.svg?style=flat&label=Travis)](https://travis-ci.org/doowb/detect-file) [![Windows Build Status](https://img.shields.io/appveyor/ci/doowb/detect-file.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/doowb/detect-file)\n\n> Detects if a file exists and returns the resolved filepath.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save detect-file\n```\n\nInstall with [yarn](https://yarnpkg.com):\n\n```sh\n$ yarn add detect-file\n```\n\n## Usage\n\n```js\nvar detect = require('detect-file');\n```\n\n## API\n\n### [detect](index.js#L33)\n\nDetect the given `filepath` if it exists.\n\n**Params**\n\n* `filepath` **{String}**: filepath to detect.\n* `options` **{Object}**: Additional options.\n* `options.nocase` **{Boolean}**: Set this to `true` to force case-insensitive filename checks. This is useful on case sensitive file systems.\n* `returns` **{String}**: Returns the detected filepath if it exists, otherwise returns `null`.\n\n**Example**\n\n```js\nvar res = detect('package.json');\nconsole.log(res);\n//=> \"package.json\"\n\nvar res = detect('fake-file.json');\nconsole.log(res)\n//=> null\n```\n\n## Case sensitive file systems\n\nWhen using the `nocase` option, this library will attempt to detect the filepath with the following methods:\n\n1. Try to read all files in the `filepath` using `fs.readdirSync`. If successful and `filepath` is a directory, return the `filepath`.\n2. Try to read all files in the `filepath`'s directory using `fs.readdirSync`. If successful, do case insensitive comparasions of the `filepath` to the files in `filepath`'s directory.\n\n## About\n\n### Related projects\n\n[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.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n### Author\n\n**Brian Woodward**\n\n* [github/doowb](https://github.com/doowb)\n* [twitter/doowb](https://twitter.com/doowb)\n\n### License\n\nCopyright © 2017, [Brian Woodward](https://github.com/doowb).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on August 05, 2017._","_attachments":{},"homepage":"https://github.com/doowb/detect-file","bugs":{"url":"https://github.com/doowb/detect-file/issues"},"license":"MIT"}