# fast-folder-size

> Node CLI or module to calculate folder size

Latest version **2.4.0** (published 2025-01-25) · AWISC license · 0 weekly downloads

## Install

```sh
npm install fast-folder-size
pnpm add fast-folder-size
yarn add fast-folder-size
bun add fast-folder-size
```

Provides the command `fast-folder-size`.

## Health

**Score 45/100 (D)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.4.0 |
| Published | 2025-01-25 |
| First published | 2021-03-09 |
| Weekly downloads | 0 |
| License | AWISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.4 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | yes |
| GitHub stars | 82 |
| Author | Simone Busoli |
| Maintainers | simoneb |
| Keywords | fast, folder, size |

## Links

- npm: https://www.npmjs.com/package/fast-folder-size
- Repository: https://github.com/simoneb/fast-folder-size
- Homepage: https://github.com/simoneb/fast-folder-size#readme
- Issues: https://github.com/simoneb/fast-folder-size/issues
- npm.io page: https://npm.io/package/fast-folder-size

## Dependencies (2)

- [decompress](https://npm.io/package/decompress.md) ^4.2.1
- [https-proxy-agent](https://npm.io/package/https-proxy-agent.md) ^7.0.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 2.4.0 (latest) — 2025-01-25
- 2.3.0 — 2024-10-11
- 2.2.0 — 2023-08-10
- 2.1.0 — 2023-06-21
- 2.0.0 — 2023-06-01
- 1.7.1 — 2022-08-18
- 1.7.0 — 2022-06-02
- 1.6.2 — 2022-05-02
- 1.6.1 — 2021-11-29
- 1.6.0 — 2021-11-29
- 1.5.0 — 2021-10-12
- 1.4.0 — 2021-07-09
- 1.3.0 — 2021-05-05
- 1.2.0 — 2021-04-15
- 1.1.0 — 2021-04-05
- … 5 more at https://npm.io/package/fast-folder-size/versions

## README

> The license of this software has changed to AWISC - Anti War ISC License

# fast-folder-size

[![ci](https://github.com/simoneb/fast-folder-size/actions/workflows/ci.yml/badge.svg)](https://github.com/simoneb/fast-folder-size/actions/workflows/ci.yml)

Node CLI or module to calculate folder size.

It uses:

- [Sysinternals DU](https://docs.microsoft.com/en-us/sysinternals/downloads/du) on Windows, automatically downloaded at
  installation time because the license does not allow redistribution. See below about specifying the download location.
- native `du` on other platforms

## Installation

```
npm i fast-folder-size
```

## Usage

### Programmatically

```js
const { promisify } = require('util')
const fastFolderSize = require('fast-folder-size')
const fastFolderSizeSync = require('fast-folder-size/sync')

// callback
fastFolderSize('.', (err, bytes) => {
  if (err) {
    throw err
  }

  console.log(bytes)
})

// promise
const fastFolderSizeAsync = promisify(fastFolderSize)
const bytes = await fastFolderSizeAsync('.')

console.log(bytes)

// sync
const bytes = fastFolderSizeSync('.')

console.log(bytes)
```

#### Aborting

The non-sync version of the API also supports `AbortSignal`, to abort the operation while in progress.

```js
const fastFolderSize = require('fast-folder-size')

const controller = new AbortController()

fastFolderSize('.', { signal: controller.signal }, (err, bytes) => {
  if (err) {
    throw err
  }

  console.log(bytes)
})

controller.abort()
```

### Command line

```bash
fast-folder-size .
```

### Downloading the Sysinternals DU.zip

By default the Sysinternals DU.zip is downloaded from https://download.sysinternals.com/files/DU.zip.

If you need to change this, e.g. to download from an internal package repository
or re-use an existing du.zip, you can set the **FAST_FOLDER_SIZE_DU_ZIP_LOCATION** environment variable.

For example:

```shell
export FAST_FOLDER_SIZE_DU_ZIP_LOCATION="https://your.internal.repository/DU.zip"
```

or

```shell
export FAST_FOLDER_SIZE_DU_ZIP_LOCATION="D://download/du.zip"
```

---
_Source: https://npm.io/package/fast-folder-size · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
