npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fs-remove-extra

v1.0.8

Published

Remove files or directories with sync/async operations and type filtering / 刪除檔案和目錄,支援同步/異步操作和類型過濾

Readme

fs-remove-extra

Remove files or directories with sync/async operations and type filtering. 刪除檔案和目錄,支援同步/異步操作和類型過濾。

Features / 主要功能

  • Remove files and directories / 刪除檔案和目錄
  • Sync and async operations / 支援同步和異步操作
  • Type filtering (files only or directories only) / 選項過濾(只刪除檔案或只刪除目錄)
  • Silent handling for non-existent paths / 靜默處理不存在的路徑
  • Compatible with fs-extra / 完全相容於 fs-extra

Install / 安裝

yarn add fs-remove-extra
yarn-tool add fs-remove-extra
yt add fs-remove-extra
pnpm add fs-remove-extra
npm install fs-remove-extra

Quick Start / 快速開始

import { 
  fsRemove, 
  fsRemoveSync,
  fsRemoveFile,
  fsRemoveFileSync,
  fsRemoveDirectories,
  fsRemoveDirectoriesSync 
} from 'fs-remove-extra';

// Remove file or directory (async) / 刪除檔案或目錄(異步)
await fsRemove('./path-to-remove');

// Remove file or directory (sync) / 刪除檔案或目錄(同步)
fsRemoveSync('./path-to-remove');

// Remove only files / 只刪除檔案
await fsRemoveFile('./file.txt');
fsRemoveFileSync('./file.txt');

// Remove only directories / 只刪除目錄
await fsRemoveDirectories('./directory');
fsRemoveDirectoriesSync('./directory');

// With options / 使用選項
await fsRemove('./path', { onlyFiles: true });
await fsRemove('./path', { onlyDirectories: true });

API

fsRemove(dirOrFile, options?)

Removes a file or directory asynchronously. The directory can have contents. 異步刪除檔案或目錄。目錄可以有內容。

fsRemoveSync(dirOrFile, options?)

Removes a file or directory synchronously. The directory can have contents. 同步刪除檔案或目錄。目錄可以有內容。

fsRemoveFile(dirOrFile)

Removes only files asynchronously. 僅異步刪除檔案。

fsRemoveFileSync(dirOrFile)

Removes only files synchronously. 僅同步刪除檔案。

fsRemoveDirectories(dirOrFile)

Removes only directories asynchronously. 僅異步刪除目錄。

fsRemoveDirectoriesSync(dirOrFile)

Removes only directories synchronously. 僅同步刪除目錄。

Options / 選項

  • onlyFiles?: boolean - Only remove if path is a file / 只在路徑是檔案時刪除
  • onlyDirectories?: boolean - Only remove if path is a directory / 只在路徑是目錄時刪除