Socket
Socket
Sign inDemoInstall

path-exists

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 3.0.0

21

index.js
'use strict';
var fs = require('fs');
var Promise = require('pinkie-promise');
const fs = require('fs');
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 = fp => new Promise(resolve => {
fs.access(fp, err => {
resolve(!err);
});
};
});
module.exports.sync = function (fp) {
var fn = typeof fs.accessSync === 'function' ? fs.accessSync : fs.statSync;
module.exports.sync = fp => {
try {
fn(fp);
fs.accessSync(fp);
return true;

@@ -21,0 +14,0 @@ } catch (err) {

{
"name": "path-exists",
"version": "2.1.0",
"version": "3.0.0",
"description": "Check if a path exists",

@@ -13,3 +13,3 @@ "license": "MIT",

"engines": {
"node": ">=0.10.0"
"node": ">=4"
},

@@ -34,9 +34,9 @@ "scripts": {

],
"dependencies": {
"pinkie-promise": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
},
"xo": {
"esnext": true
}
}

@@ -23,5 +23,5 @@ # path-exists [![Build Status](https://travis-ci.org/sindresorhus/path-exists.svg?branch=master)](https://travis-ci.org/sindresorhus/path-exists)

// foo.js
var pathExists = require('path-exists');
const pathExists = require('path-exists');
pathExists('foo.js').then(function (exists) {
pathExists('foo.js').then(exists => {
console.log(exists);

@@ -37,3 +37,3 @@ //=> true

Returns a promise that resolves to a boolean of whether the path exists.
Returns a promise for a boolean of whether the path exists.

@@ -45,4 +45,9 @@ ### pathExists.sync(path)

## Related
- [path-exists-cli](https://github.com/sindresorhus/path-exists-cli) - CLI for this module
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc