{"id":24206581,"url":"https://github.com/andyg2/clustersize","last_synced_at":"2025-07-23T15:04:28.353Z","repository":{"id":177770874,"uuid":"660886616","full_name":"andyg2/clustersize","owner":"andyg2","description":"This script generates a bar chart visualization of file sizes and total clusters used within a specified directory. It calculates the total size of files and the number of clusters for each cluster size in the given directory and generates a chart to visualize the data.","archived":false,"fork":false,"pushed_at":"2023-07-01T17:47:47.000Z","size":65,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T07:12:52.681Z","etag":null,"topics":["cluster","size-calculation"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andyg2.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-01T05:50:30.000Z","updated_at":"2025-02-10T09:12:15.000Z","dependencies_parsed_at":"2023-07-10T22:46:34.821Z","dependency_job_id":null,"html_url":"https://github.com/andyg2/clustersize","commit_stats":null,"previous_names":["andyg2/clustersize"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andyg2/clustersize","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyg2%2Fclustersize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyg2%2Fclustersize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyg2%2Fclustersize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyg2%2Fclustersize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andyg2","download_url":"https://codeload.github.com/andyg2/clustersize/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andyg2%2Fclustersize/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265236811,"owners_count":23732504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cluster","size-calculation"],"created_at":"2025-01-14T00:34:48.700Z","updated_at":"2025-07-14T03:07:56.128Z","avatar_url":"https://github.com/andyg2.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Directory File Size and Cluster Chart Generator\n\nThis PHP script generates a bar chart representing the file sizes and total clusters used by files in a specified directory. The chart helps visualize the distribution of file sizes and cluster usage based on different cluster sizes.\n\nThis was written to solve the tuning dilema of which cluster size to choose for a new drive.\n\n![](assets/20230701_135615_dilema.jpg)\n\nThe output of the script is a chart similar to this.\n\n![](assets/20230701_135629_solution.png)\n\nSimply put, it calculates the number of clusters (purple) and the amount of space (blue) that would be consumed for a specific directory for each of the cluster sizes.\n\n**In the example above 32 million clusters of size 8192 would consume 263GB and that would be a balance between speed and space. As I want my games to load faster I accept the additional 6GB of space and choose 256KB cluster size.**\n\n## Prerequisites\n\n- PHP 5.6 or above\n\n## Getting Started\n\n1. Clone or download the script to your local machine.\n2. Open the script in a text editor.\n3. Set the desired cluster sizes in the `$clusterSizes` array. Each element represents a cluster size in bytes. The script will calculate the file sizes and total clusters used for each cluster size.\n4. Specify the directory you want to scan by assigning the path to the `$directory` variable. Ensure that the directory path is valid and accessible.\n5. Save the script.\n\n## Usage\n\nTo generate the chart, run the PHP script from the command line or a web server that supports PHP. The chart will be displayed in the browser as a PNG image.\n\n## Customization\n\n### Chart Dimensions\n\nYou can customize the dimensions of the chart by modifying the following variables in the drawChart function:\n\n$width: Specifies the width of the chart image in pixels.\n$height: Specifies the height of the chart image in pixels.\n\n### Chart Colors\n\nYou can customize the colors used in the chart by modifying the following variables in the drawChart function:\n\n$backgroundColor: Specifies the background color of the chart.\n$barColor1: Specifies the color of the file size bars.\n$barColor2: Specifies the color of the total cluster bars.\n$textColor: Specifies the color of the text labels.\n\n### Label Formatting\n\nYou can customize the formatting of the labels displayed on the chart by modifying the following functions:\n\nformatBytes($bytes): Formats the file size labels. Modify this function to change the formatting of the file size labels, e.g., adding a different unit or changing the decimal precision.\n\nformatNums($number): Formats the total cluster labels. Modify this function to change the formatting of the total cluster labels, e.g., adding a different unit or changing the decimal precision.\nAdditional Customization\n\nYou can further customize the script as per your requirements, such as modifying the chart layout, adding legends, or changing the directory scanning logic.\n\n### License\n\nThis script is released under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyg2%2Fclustersize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandyg2%2Fclustersize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandyg2%2Fclustersize/lists"}