Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

path-exists

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-exists - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

15

index.js
'use strict';
var fs = require('fs')
var fs = require('fs');
var Promise = require('pinkie-promise');
module.exports = function (pth, cb) {
module.exports = function (fp) {
var fn = typeof fs.access === 'function' ? fs.access : fs.stat;
fn(pth, function (err) {
cb(null, !err);
return new Promise(function (resolve) {
fn(fp, function (err) {
resolve(!err);
});
});
};
module.exports.sync = function (pth) {
module.exports.sync = function (fp) {
var fn = typeof fs.accessSync === 'function' ? fs.accessSync : fs.statSync;
try {
fn(pth);
fn(fp);
return true;

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

10

package.json
{
"name": "path-exists",
"version": "1.0.0",
"version": "2.0.0",
"description": "Check if a path exists",

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

"scripts": {
"test": "node test.js"
"test": "xo && ava"
},

@@ -34,5 +34,9 @@ "files": [

],
"dependencies": {
"pinkie-promise": "^1.0.0"
},
"devDependencies": {
"ava": "0.0.4"
"ava": "*",
"xo": "*"
}
}

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

pathExists.sync('foo.js');
//=> true
pathExists('foo.js').then(function (exists) {
console.log(exists);
//=> true
});
```

@@ -33,18 +35,6 @@

### pathExists(path, callback)
### pathExists(path)
#### path
Returns a promise that resolves to a boolean of whether the path exists.
*Required*
Type: `string`
#### callback(error, exists)
*Required*
Type: `function`
##### exists
Type: `boolean`
### pathExists.sync(path)

@@ -54,10 +44,5 @@

#### path
*Required*
Type: `string`
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc