{"name":"@sindresorhus/df","version":"5.0.0","description":"Get free disk space info from `df -kP`","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/df.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=20"},"scripts":{"test":"xo && ava"},"keywords":["df","dfkp","df-kp","disk","space","free","info","data","fs","filesystem","file-system","drive","mount","size","capacity"],"dependencies":{"execa":"^9.6.0"},"devDependencies":{"ava":"^6.4.1","xo":"^1.2.2"},"_id":"@sindresorhus/df@5.0.0","gitHead":"376fb6156e1c09eb8e2eb78e8e5a0ae356bea0b5","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/df/issues"},"homepage":"https://github.com/sindresorhus/df#readme","_nodeVersion":"20.19.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-pr7nIDyyNDuZou1MoEReqYYemOFx5NomXsC7+YDQoLZia7YJKfRXEiiZYCKiVeaMkzefNz+3c5U2UbbgOWGeYw==","shasum":"dff165162c9e64a324e143034911f04e09834676","tarball":"http://registry-npm.ywwl.com/@sindresorhus/df/download/@sindresorhus/df-5.0.0.tgz","fileCount":5,"unpackedSize":9715,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD694j2/VyPbuUt+qJaosLDDVeOR/ZIzfyaYE6pMvPMVAIhAIOfP/2b63DPok50QuxKnq5ftKBDvmxL3dgdTDkIAA6V"}],"size":3634,"noattachment":false,"key":"/@sindresorhus/df/-/@sindresorhus/df-5.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/df_5.0.0_1757797786291_0.042930124213672594"},"_hasShrinkwrap":false,"readme":"# df\n\n> Get free disk space info from [`df -kP`](https://en.wikipedia.org/wiki/Df_\\(Unix\\))\n\nWorks on any Unix-based system like macOS and Linux.\n\n*Created because all the other `df` wrappers are terrible. This one uses simple and explicit parsing. Uses `execFile` rather than `exec`. Ensures better platform portability by using the `-P` flag. Returns sizes in bytes instead of kilobytes and the capacity as a float.*\n\n## Install\n\n```sh\nnpm install @sindresorhus/df\n```\n\n## Usage\n\n```js\nimport {\n\tdiskSpace,\n\tdiskSpaceForFilesystem,\n\tdiskSpaceForFilesystemOwningPath\n} from '@sindresorhus/df';\n\nconsole.log(await diskSpace());\n/*\n[\n\t{\n\t\tfilesystem: '/dev/disk1',\n\t\ttype: 'ext4',\n\t\tsize: 499046809600,\n\t\tused: 443222245376,\n\t\tavailable: 55562420224,\n\t\tcapacity: 0.89,\n\t\tmountpoint: '/'\n\t},\n\t…\n]\n*/\n\nconsole.log(await diskSpaceForFilesystem('/dev/disk1'));\n/*\n{\n\tfilesystem: '/dev/disk1',\n\t…\n}\n*/\n\nconsole.log(await diskSpaceForFilesystemOwningPath('.'));\n/*\n{\n\tfilesystem: '/dev/disk1',\n\t…\n}\n*/\n```\n\n## API\n\n### diskSpace()\n\nReturns a `Promise<object[]>` with a list of space info objects for each filesystem.\n\n### diskSpaceForFilesystem(path)\n\nReturns a `Promise<object>` with the space info for the given filesystem path.\n\n- `filesystem` - Name of the filesystem.\n- `type` - Type of the filesystem.\n- `size` - Total size in bytes.\n- `used` - Used size in bytes.\n- `available` - Available size in bytes.\n- `capacity` - Capacity as a float from `0` to `1`.\n- `mountpoint` - Disk mount location.\n\n#### path\n\nType: `string`\n\nA path to a [filesystem device file](https://en.wikipedia.org/wiki/Device_file). Example: `'/dev/disk1'`.\n\n### diskSpaceForFilesystemOwningPath(path)\n\nReturns a `Promise<object>` with the space info for the filesystem the given path is part of.\n\n#### path\n\nType: `string`\n\nA path to a file/directory on the filesystem to get the space info for.\n","publish_time":1757797786479,"_cnpm_publish_time":1757797786479,"dist-tags":{"latest":"4.0.0"}}