Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fs-exists-async

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

fs-exists-async

A simple lightweight zero-dependency asynchronous utility function to check the existence of files and directories using Node.js' fs.promises.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

fs-exists-async

fs-exists-async is a lightweight utility that allows you to check if a file or directory exists asynchronously using Node.js' native fs.promises module.

It's easy to use, has no external dependencies, and returns true if the path exists and false if it doesn't.

Installation

You can install fs-exists-async via npm, yarn or pnpm:

npm install fs-exists-async
# or
yarn add fs-exists-async
# or
pnpm add fs-exists-async

Usage

To check if a file or directory exists, import the exists function and use it as follows:

import { exists } from 'fs-exists-async';

// Check if a file exists
const filePath = './example.txt';
const fileExists = await exists(filePath);
console.log(`File exists: ${fileExists}`);

// Check if a directory exists
const directoryPath = './example-directory';
const directoryExists = await exists(directoryPath);
console.log(`Directory exists: ${directoryExists}`);

License

This package is open-source and distributed under the MIT License.

Keywords

FAQs

Package last updated on 12 Sep 2023

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