{
  "_id": "detect-file",
  "maintainers": [
    {
      "email": "github@sellside.com",
      "name": "jonschlinkert"
    },
    {
      "email": "brian.woodward@gmail.com",
      "name": "doowb"
    }
  ],
  "keywords": [
    "detect",
    "exists",
    "file",
    "file exists",
    "file-path",
    "filepath",
    "path",
    "resolve",
    "resolve file",
    "resolve filepath"
  ],
  "dist-tags": {
    "latest": "1.0.0"
  },
  "author": {
    "name": "Brian Woodward",
    "url": "https://github.com/doowb"
  },
  "_rev": "7-3f1b5f771dca135893d1062ca310ff00",
  "description": "Detects if a file exists and returns the resolved filepath.",
  "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._",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/doowb/detect-file.git"
  },
  "users": {
    "kiinlam": true
  },
  "bugs": {
    "url": "https://github.com/doowb/detect-file/issues"
  },
  "license": "MIT",
  "versions": {
    "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",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/detect-file/-/detect-file-0.1.0.tgz",
        "integrity": "sha512-akiVcMZym+vO3IxctGG9dnuJT4AYQTAhjsGbjeGqqMUr9Ffy7XEAUmfKLSHugr/tGLaAZ4jWROErPPrsfG8+bQ==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIHiT1yGEkS19AcRBSOVnO4zcAisK3Z6OhfT2yzQ/0YyxAiBhU/UJNGyP7fjWSF15w7s3BDs67NRqA5bPlpYWpnx74w=="
          }
        ]
      },
      "maintainers": [
        {
          "name": "doowb",
          "email": "brian.woodward@gmail.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "packages-16-east.internal.npmjs.com",
        "tmp": "tmp/detect-file-0.1.0.tgz_1467841748733_0.7613796112127602"
      }
    },
    "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",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/detect-file/-/detect-file-1.0.0.tgz",
        "integrity": "sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIAqt3Nzu+aynqG01vaqEKluKR5TiDQmV6kLuzbhcopnXAiB2i+fGim8yb2iW8FWoZmSiUKCq+J1+osR9icIhaCBz0w=="
          }
        ]
      },
      "maintainers": [
        {
          "email": "github@sellside.com",
          "name": "jonschlinkert"
        },
        {
          "email": "brian.woodward@gmail.com",
          "name": "doowb"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/detect-file-1.0.0.tgz_1501988960217_0.8393025605473667"
      }
    }
  },
  "name": "detect-file",
  "time": {
    "modified": "2026-05-20T15:56:36.094Z",
    "created": "2016-07-06T21:49:09.925Z",
    "0.1.0": "2016-07-06T21:49:09.925Z",
    "1.0.0": "2017-08-06T03:09:20.319Z"
  },
  "readmeFilename": "README.md",
  "homepage": "https://github.com/doowb/detect-file"
}