{"id":15984213,"url":"https://github.com/adriano-di-giovanni/node-df","last_synced_at":"2025-03-17T15:32:01.332Z","repository":{"id":17637586,"uuid":"20441946","full_name":"adriano-di-giovanni/node-df","owner":"adriano-di-giovanni","description":"A cross-platform Node.js wrapper around the standard Unix program, df.","archived":false,"fork":false,"pushed_at":"2021-07-26T11:14:13.000Z","size":24,"stargazers_count":15,"open_issues_count":6,"forks_count":15,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T16:46:29.115Z","etag":null,"topics":["df","unix"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/adriano-di-giovanni.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}},"created_at":"2014-06-03T12:34:54.000Z","updated_at":"2023-10-22T08:08:52.000Z","dependencies_parsed_at":"2022-09-06T03:21:00.254Z","dependency_job_id":null,"html_url":"https://github.com/adriano-di-giovanni/node-df","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adriano-di-giovanni%2Fnode-df","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adriano-di-giovanni%2Fnode-df/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adriano-di-giovanni%2Fnode-df/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adriano-di-giovanni%2Fnode-df/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adriano-di-giovanni","download_url":"https://codeload.github.com/adriano-di-giovanni/node-df/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243713398,"owners_count":20335567,"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":["df","unix"],"created_at":"2024-10-08T02:05:06.851Z","updated_at":"2025-03-17T15:32:01.027Z","avatar_url":"https://github.com/adriano-di-giovanni.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# df\n\n[![Build Status](https://travis-ci.org/adriano-di-giovanni/node-df.svg?branch=master)](https://travis-ci.org/adriano-di-giovanni/node-df)\n\n`node-df` (abbreviation of **d**isk **f**ree) is a cross-platform Node.js wrapper around the standard Unix computer program, [df](http://en.wikipedia.org/wiki/Df_(Unix)).\n\n## Installation\n\n```\n$ npm install node-df\n```\n\n## Usage\n\n### Basic\n\n```javascript\nvar\n    df = require('node-df');\n\ndf(function (error, response) {\n    if (error) { throw error; }\n\n    console.log(JSON.stringify(response, null, 2));\n});\n```\n\nOutput from `df` looks like this:\n\n```json\n[\n  {\n    \"filesystem\": \"/dev/disk0s2\",\n    \"size\": 487546976,\n    \"used\": 164493356,\n    \"available\": 322797620,\n    \"capacity\": 0.34,\n    \"mount\": \"/\"\n  },\n  {\n    \"filesystem\": \"devfs\",\n    \"size\": 186,\n    \"used\": 186,\n    \"available\": 0,\n    \"capacity\": 1,\n    \"mount\": \"/dev\"\n  },\n  {\n    \"filesystem\": \"map -hosts\",\n    \"size\": 0,\n    \"used\": 0,\n    \"available\": 0,\n    \"capacity\": 1,\n    \"mount\": \"/net\"\n  },\n  {\n    \"filesystem\": \"map auto_home\",\n    \"size\": 0,\n    \"used\": 0,\n    \"available\": 0,\n    \"capacity\": 1,\n    \"mount\": \"/home\"\n  },\n  {\n    \"filesystem\": \"localhost:/CPYpGwk1x_UGJYGx-93flp\",\n    \"size\": 487546976,\n    \"used\": 487546976,\n    \"available\": 0,\n    \"capacity\": 1,\n    \"mount\": \"/Volumes/MobileBackups\"\n  }\n]\n```\n\nValues for `size`, `used` and `available` are expressed in `KiB` (1024 bytes).\n\nValue for `capacity` is a number between `0` and `1`. `capacity` is also known as `used%`\n\n`node-df` correctly parsed output from `df` unix program for filesystems and mount folders with whitespaces in the name.\n\n### Advanced\n\n```\nvar\n    options = {\n        file: '/',\n        prefixMultiplier: 'GB',\n        isDisplayPrefixMultiplier: true,\n        precision: 2\n    };\n\ndf(options, function (error, response) {\n    if (error) { throw error; }\n\n    console.log(JSON.stringify(response, null, 2));\n});\n```\n\nOutput from `df` now looks like this:\n\n```json\n[\n  {\n    \"filesystem\": \"/dev/disk0s2\",\n    \"size\": \"499.25GB\",\n    \"used\": \"168.44GB\",\n    \"available\": \"330.54GB\",\n    \"capacity\": 0.34,\n    \"mount\": \"/\"\n  }\n]\n```\n\n#### Options\n\n* **file**: output the amount of free space of the file system containing the specified file;\n* **prefixMultiplier**: convert `size`, `used` and `available` values from `KiB` to `MiB`, `GiB`, `PiB`, `EiB`, `ZiB`, `YiB`, `MB`, `GB`, `PB`, `EB`, `ZB`, `YB`;\n* **isDisplayPrefixMultiplier**: if `true`, values for `size`, `used` and `available` are converted to strings and `prefixMultiplier` is displayed (see example above).\n* **precision**: round `size`, `used` and `available` values to `precision` decimal digits.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadriano-di-giovanni%2Fnode-df","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadriano-di-giovanni%2Fnode-df","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadriano-di-giovanni%2Fnode-df/lists"}