
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
exists-file
Advanced tools
Check if a file exists. A fs.exists implementation that is not deprecated.
Check if a file exists. A fs.exists implementation that is not deprecated.
Because fs.exist and fs.existsSync are deprecated this an implementation using fs.stats and fs.statsSync for get the same result.
Also always keep in mind:
fs.exists() should not be used to check if a file exists before calling fs.open(). Doing so introduces a race condition since other processes may change the file's state between the two calls. Instead, user code should call fs.open() directly and handle the error raised if the file is non-existent.
npm install exists-file --save
var existsFile = require('exists-file')
// async with a callback
existsFile('./README.md', console.log) // => null, true
// async with a promise
existsFile('./README.md').then(console.log).catch(console.error) // => true
// sync
var exists = existsFile.sync('./README.md')
console.log(exists) // => true
Required
Type: string
The relative or absolute file path.
Type: function
If cb
is not provided then it returns a promise
.
Required
Type: string
The relative or absolute file path.
MIT © Kiko Beats
FAQs
Check if a file exists. A fs.exists implementation that is not deprecated.
We found that exists-file 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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.