is-there
Version:
Check if a file or directory exists in a given path.
55 lines • 1.76 kB
JSON
{
"name": "is-there",
"version": "4.3.0",
"description": "Check if a file or directory exists in a given path.",
"main": "lib/index.js",
"directories": {
"example": "example",
"test": "test"
},
"scripts": {
"test": "mocha test"
},
"repository": {
"type": "git",
"url": "git@github.com:IonicaBizau/node-is-there.git"
},
"keywords": [
"fs",
"exists",
"file",
"directory"
],
"author": "Ionică Bizău <bizauionica@gmail.com> (http://ionicabizau.net)",
"contributors": [
"Kevin Harrison <keharriso@gmail.com>"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/IonicaBizau/node-is-there/issues"
},
"homepage": "https://github.com/IonicaBizau/node-is-there",
"dependencies": {},
"devDependencies": {
"mocha": "^2.2.4"
},
"blah": {
"h_img": "http://i.imgur.com/ZHzpvvE.png",
"description": [
{
"h2": "Why? `fs.exists` already does the job!"
},
{
"p": "Because `fs.exists` and `fs.existsSync` ~~will be~~ are deprecated and in some cases we still need them!"
},
{
"blockquote": [
"`fs.exists()` is an anachronism and exists only for historical reasons. There should almost never be a reason to use it in your own code.",
"In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to `fs.exists()` and `fs.open()`. Just open the file and handle the error when it's not there.",
"**`fs.exists()` will be deprecated.**",
"<sup>([Source](http://nodejs.org/api/fs.html#fs_fs_exists_path_callback), emphasis added)</sup>"
]
}
]
}
}