diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
commit | abd94a7f5a50f43c797a11b53549ae48fff667c3 (patch) | |
tree | ab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/path-exists | |
parent | a0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff) | |
download | wallet-core-abd94a7f5a50f43c797a11b53549ae48fff667c3.tar.xz |
add node_modules to address #4364
Diffstat (limited to 'node_modules/path-exists')
-rw-r--r-- | node_modules/path-exists/index.js | 24 | ||||
-rw-r--r-- | node_modules/path-exists/license | 21 | ||||
-rw-r--r-- | node_modules/path-exists/package.json | 103 | ||||
-rw-r--r-- | node_modules/path-exists/readme.md | 45 |
4 files changed, 193 insertions, 0 deletions
diff --git a/node_modules/path-exists/index.js b/node_modules/path-exists/index.js new file mode 100644 index 000000000..a7e680a76 --- /dev/null +++ b/node_modules/path-exists/index.js @@ -0,0 +1,24 @@ +'use strict'; +var fs = require('fs'); +var Promise = require('pinkie-promise'); + +module.exports = function (fp) { + var fn = typeof fs.access === 'function' ? fs.access : fs.stat; + + return new Promise(function (resolve) { + fn(fp, function (err) { + resolve(!err); + }); + }); +}; + +module.exports.sync = function (fp) { + var fn = typeof fs.accessSync === 'function' ? fs.accessSync : fs.statSync; + + try { + fn(fp); + return true; + } catch (err) { + return false; + } +}; diff --git a/node_modules/path-exists/license b/node_modules/path-exists/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/path-exists/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/path-exists/package.json b/node_modules/path-exists/package.json new file mode 100644 index 000000000..654d6002f --- /dev/null +++ b/node_modules/path-exists/package.json @@ -0,0 +1,103 @@ +{ + "_args": [ + [ + { + "raw": "path-exists@^2.0.0", + "scope": null, + "escapedName": "path-exists", + "name": "path-exists", + "rawSpec": "^2.0.0", + "spec": ">=2.0.0 <3.0.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/find-up" + ] + ], + "_from": "path-exists@>=2.0.0 <3.0.0", + "_id": "path-exists@2.1.0", + "_inCache": true, + "_location": "/path-exists", + "_nodeVersion": "4.2.1", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "_npmVersion": "2.14.7", + "_phantomChildren": {}, + "_requested": { + "raw": "path-exists@^2.0.0", + "scope": null, + "escapedName": "path-exists", + "name": "path-exists", + "rawSpec": "^2.0.0", + "spec": ">=2.0.0 <3.0.0", + "type": "range" + }, + "_requiredBy": [ + "/find-up" + ], + "_resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "_shasum": "0feb6c64f0fc518d9a754dd5efb62c7022761f4b", + "_shrinkwrap": null, + "_spec": "path-exists@^2.0.0", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/find-up", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/path-exists/issues" + }, + "dependencies": { + "pinkie-promise": "^2.0.0" + }, + "description": "Check if a path exists", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "directories": {}, + "dist": { + "shasum": "0feb6c64f0fc518d9a754dd5efb62c7022761f4b", + "tarball": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "gitHead": "3af423661e78466764f87c5712263c5d7a1ce5b7", + "homepage": "https://github.com/sindresorhus/path-exists", + "keywords": [ + "path", + "exists", + "exist", + "file", + "filepath", + "fs", + "filesystem", + "file-system", + "access", + "stat" + ], + "license": "MIT", + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "name": "path-exists", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/path-exists.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.1.0" +} diff --git a/node_modules/path-exists/readme.md b/node_modules/path-exists/readme.md new file mode 100644 index 000000000..8fbcd68df --- /dev/null +++ b/node_modules/path-exists/readme.md @@ -0,0 +1,45 @@ +# path-exists [![Build Status](https://travis-ci.org/sindresorhus/path-exists.svg?branch=master)](https://travis-ci.org/sindresorhus/path-exists) + +> Check if a path exists + +Because [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) is being [deprecated](https://github.com/iojs/io.js/issues/103), but there's still a genuine use-case of being able to check if a path exists for other purposes than doing IO with it. + +Never use this before handling a file though: + +> 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. + + +## Install + +``` +$ npm install --save path-exists +``` + + +## Usage + +```js +// foo.js +var pathExists = require('path-exists'); + +pathExists('foo.js').then(function (exists) { + console.log(exists); + //=> true +}); +``` + + +## API + +### pathExists(path) + +Returns a promise that resolves to a boolean of whether the path exists. + +### pathExists.sync(path) + +Returns a boolean of whether the path exists. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) |