fast-folder-size

Node CLI or module to calculate folder size

Usage no npm install needed!

<script type="module">
  import fastFolderSize from 'https://cdn.skypack.dev/fast-folder-size';
</script>

README

fast-folder-size

ci

Node CLI or module to calculate folder size.

It uses:

  • Sysinternals DU on Windows, automatically downloaded at installation time because the license does not allow redistribution
  • native du on other platforms

Installation

npm i fast-folder-size

Usage

Programmatically

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)

Command line

fast-folder-size .