New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

sizeable

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sizeable

Get the size of a folder by iterating through its subfiles and folders.

latest
Source
npmnpm
Version
0.1.4
Version published
Maintainers
1
Created
Source

sizeable NPM Version

Get the size of a folder by iterating through its subfiles and folders

Installing

Local

npm i sizeable

Global

npm i -g sizeable

Usage

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));
        });
    });
});

Options

ignore

Regular expresion for ignore folders or files

onlyFolders

Ignore all files

CLI tool

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

License

MIT

Keywords

folder

FAQs

Package last updated on 30 Aug 2016

Did you know?

Socket

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.

Install

Related posts