
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
Get the size of a folder by iterating through its subfiles and folders
npm i sizeable
npm i -g sizeable
var sizeable = require('sizeable');
sizeable(myFolderPath, [options or ignore regex pattern], callback);
Example:
var sizeable = require('sizeable');
var folder = '/my/folder/path';
sizeable(folder, function callback(err, size, details) {
if (err) {
throw err;
}
console.log(size, 'bytes');
console.log(sizeable.toKb(size), 'Kb');
console.log(sizeable.toMb(size), 'Mb');
console.log(sizeable.toGb(size), 'Gb');
console.log(sizeable.toTb(size), 'Tb');
console.log(sizeable.toFormat(size, 'b'), 'bytes');
console.log(sizeable.toFormat(size, 'kb'), 'Kb'); // Valid format 'b', 'kb', 'mb', 'gb' and 'tb' (Ignore case)
});
var sizeable = require('sizeable');
var folder = '/my/folder/path';
var ignore = /node_modules/;
sizeable(folder, ignore, function callback(err, size, details) {
if (err) {
throw err;
}
sizeable.detailsSizeTo(details, 'mb', function(err, details) {
if (err) {
throw err;
}
console.log(JSON.stringify(details, null, 2));
});
});
var sizeable = require('sizeable');
var folder = '/my/folder/path';
var ignore = /node_modules/;
sizeable(folder, ignore, function callback(err, size, details) {
if (err) {
throw err;
}
sizeable.detailsSizeTo(details, 'mb', function(err, details) {
if (err) {
throw err;
}
sizeable.sortDetailsBySize(details, function(err, details) {
if (err) {
throw err;
}
console.log(JSON.stringify(details, null, 2));
});
});
});
Regular expresion for ignore folders or files
Ignore all files
sizeable -f /my/folder/path -i "node_modules|.git"
# ~> 12.32 mb
sizeable -f /my/folder/path -i "node_modules|.git" -F gb
# ~> 0.12 gb
For show more information use -h
sizeable -h
MIT
FAQs
Get the size of a folder by iterating through its subfiles and folders.
The npm package sizeable receives a total of 10 weekly downloads. As such, sizeable popularity was classified as not popular.
We found that sizeable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.