Estimates install size and disk usage per package.
Analyzes node_modules to report per-package and total sizes, helping identify heavy dependencies.
Summary
Functions
Analyzes a node_modules directory and returns size info per package.
Formats a size in bytes as a human-readable string.
Returns a summary of the node_modules analysis.
Returns the top N largest packages.
Calculates total file count.
Calculates total install size across all packages.
Types
@type size_entry() :: %{ name: String.t(), version: String.t() | nil, size: non_neg_integer(), file_count: non_neg_integer() }
Functions
@spec analyze(String.t()) :: [size_entry()]
Analyzes a node_modules directory and returns size info per package.
@spec format_size(non_neg_integer()) :: String.t()
Formats a size in bytes as a human-readable string.
@spec summary([size_entry()]) :: %{ package_count: non_neg_integer(), total_size: non_neg_integer(), total_files: non_neg_integer(), formatted_size: String.t() }
Returns a summary of the node_modules analysis.
@spec top(String.t(), non_neg_integer()) :: [size_entry()]
Returns the top N largest packages.
@spec total_files([size_entry()]) :: non_neg_integer()
Calculates total file count.
@spec total_size([size_entry()]) :: non_neg_integer()
Calculates total install size across all packages.