Socket
Socket
Sign inDemoInstall

exists-sync

Package Overview
Dependencies
0
Maintainers
5
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    exists-sync

existsSync that also checks for symlinks


Version published
Weekly downloads
116K
increased by10.94%
Maintainers
5
Created
Weekly downloads
 

Readme

Source

exists-sync

Build Status Build status

Replacement for fs.existsSync(), which is being deprecated:

"fs.exists() is an anachronism and exists only for historical reasons. There should almost never be a reason to use it in your own code.

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."

exists-sync will recursively follow symlinks to verify the target file exists, rather than giving a false positive on a symlink whose target has been removed.

Keywords

FAQs

Last updated on 04 Nov 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc