
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
fs-exists-sync
Advanced tools
Drop-in replacement for `fs.existsSync` with zero dependencies. Other libs I found either have crucial differences from fs.existsSync, or unnecessary dependencies. See README.md for more info.
Drop-in replacement for
fs.existsSyncwith zero dependencies. Other libs I found either have crucial differences from fs.existsSync, or unnecessary dependencies. See README.md for more info.
Install with npm:
$ npm install fs-exists-sync --save
var exists = require('fs-exists-sync');
console.log(exists('.'));
//=> true
console.log(exists(process.cwd()));
//=> true
console.log(exists('README.md'));
//=> true
console.log(exists('foo.txt'));
//=> false
console.log(exists(''));
//=> false
console.log(exists());
//=> false
I just want a simple replacement for fs.existsSync. Here is what I found:
false if the path exists but is a directory.fs.You might also be interested in these projects:
path.isAbolute. Returns true if a file path is absolute. | homepagepath.parse, parses a filepath into an object. | homepagePull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Generate readme and API documentation with verb:
$ npm install verb && npm run docs
Or, if verb is installed globally:
$ verb
Install dev dependencies:
$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb, v0.9.0, on April 09, 2016.
fs-extra is a popular package that extends the native Node.js fs module with additional methods, including both synchronous and asynchronous versions of file and directory existence checks. It offers more functionality compared to fs-exists-sync, such as copying, moving, and removing files and directories.
path-exists is another package that provides a simple way to check if a path exists. Unlike fs-exists-sync, path-exists offers asynchronous methods, making it more suitable for non-blocking operations in Node.js applications.
file-exists is a package that provides both synchronous and asynchronous methods to check if a file exists. It is similar to fs-exists-sync but offers more flexibility with its asynchronous API.
FAQs
Drop-in replacement for `fs.existsSync` with zero dependencies. Other libs I found either have crucial differences from fs.existsSync, or unnecessary dependencies. See README.md for more info.
The npm package fs-exists-sync receives a total of 2,617,444 weekly downloads. As such, fs-exists-sync popularity was classified as popular.
We found that fs-exists-sync demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.