Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

get-folder-size

2.0.0 • Public • Published

get-folder-size

Get the size of a folder by iterating through its sub-files and folders.

Usage

getFolderSize(folder, [regexIgnorePattern], callback)

Example:

const getSize = require('get-folder-size');
 
getSize(myFolder, (err, size) => {
  if (err) { throw err; }
 
  console.log(size + ' bytes');
  console.log((size / 1024 / 1024).toFixed(2) + ' MB');
});

CLI tool

npm i -g get-folder-size
get-folder-size --folder=/my/folder --ignore=node_modules

Size vs Size on disk

This module calculates the actual file size, and not the size on disk.

License

MIT

Keywords

install

npm i get-folder-size

Downloadsweekly downloads

22,597

version

2.0.0

license

MIT

repository

githubgithub

last publish

collaborators

  • avatar