fast-dir-size
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

fast-dir-size

Calculates the total size of a folder and its subfolders.

Usage

Install with npm

npm i fast-dir-size
// load using import
import { getDirSize, getDirSizeSync } from 'fast-dir-size'
// or using commonjs
const { getDirSize, getDirSizeSync } = require('fast-dir-size')


const os = require('os');
const { join } = require('path');
const path = join(os.homedir(), 'Downloads');

// Example using asynchronous function
getDirSize(path)
  .then((size) => console.log(`Size: ${size} bytes`)); // Output: Size: 338160322 bytes

// Example using synchronous function
const size = getDirSizeSync(path);
console.log(`Size: ${size} bytes`); // Output: Size: 338160322 bytes

Author

Rikelmy Lopes

Made with ❤️ by Rikelmy Lopes! Get in touch!

Package Sidebar

Install

npm i fast-dir-size

Weekly Downloads

72

Version

1.3.0

License

MIT

Unpacked Size

8.7 kB

Total Files

7

Last publish

Collaborators

  • rikelmy_lopes