Socket
Socket
Sign inDemoInstall

node-file-exists

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-file-exists - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

33

index.js
"use strict";
var fs_1 = require('fs');
function fileExists(pathToFile) {
try {
fs_1.accessSync(pathToFile, fs_1.F_OK);
} catch (e) {
if (e) {
if (e.code !== 'ENOENT') {
console.log(e);
}
return false;
}
}
return true;
function fileExists(path, silent) {
if (silent === void 0) { silent = true; }
try {
fs_1.accessSync(path, fs_1.F_OK);
}
catch (e) {
if (e) {
if (!silent) {
console.log(e);
}
return false;
}
}
return true;
}
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = fileExists;
exports.__esModule = true;
exports["default"] = fileExists;
{
"name": "node-file-exists",
"version": "1.0.0",
"version": "1.1.0",
"description": "Check if a file exists in Node.js. ES6 module compatible, non-depracated fs utils.",

@@ -13,2 +13,7 @@ "main": "index.js",

},
"files": [
"package.json",
"README.md",
"index.js"
],
"keywords": [

@@ -15,0 +20,0 @@ "file",

@@ -18,4 +18,15 @@ # File Exists Sync

exists('/path/to/file.js'); // true or false
exists('/path/to/file.js');
// true or false
```
##### Silent
Pass in false as a second parameter to produce errors on failure.
```js
import exists from 'node-file-exists';
exists('/path/to/file.js', false);
// true or Error
```
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