Socket
Socket
Sign inDemoInstall

file-exists-dazinatorfork

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-exists-dazinatorfork

Check if filepath exists and is a file. Note this is a fork of file-exists dpenedency with some ammendments.


Version published
Weekly downloads
49K
decreased by-11.78%
Maintainers
1
Weekly downloads
 
Created
Source

file-exists

Check if filepath exists and is a file. Returns false for directories.

(Requires node >=6.0.0)

Install

npm install file-exists --save

Usage

const fileExists = require('file-exists');

fileExists('/index.html', (err, exists) => console.log(exists)) // OUTPUTS: true or false

fileExists('/index.html').then(exists => {
  console.log(exists) // OUTPUTS: true or false
})

const exists = await fileExists('/index.html')

console.log(fileExists.sync('/index.html')) // OUTPUTS: true or false

Options

fileExists(filepath[, options, callback])
  • filepath - the path to the file to check if it exists
  • options - an object of options
    • root - the root directory to look in (or cwd)
  • callback(err, exists) - gets called when checking is done
fileExists.sync(filepath[, options])
  • filepath - the path to the file to check if it exists
  • options - an object of options
    • root - the root directory to look in (or cwd)

Run Tests

npm install
npm test

Keywords

FAQs

Package last updated on 15 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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