# diskspace

> A simple disk space checker module. Check out the GitHub page for more details.

Latest version **2.0.0** (published 2017-03-17) · 0 weekly downloads

## Install

```sh
npm install diskspace
pnpm add diskspace
yarn add diskspace
bun add diskspace
```

## Health

**Score 18/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2017-03-17 |
| First published | 2012-05-03 |
| Weekly downloads | 0 |
| TypeScript types | separate (@types/diskspace) |
| Module format | CommonJS |
| Node | * |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 57 |
| Author | Kevin Whitman |
| Maintainers | keverw |

## Links

- npm: https://www.npmjs.com/package/diskspace
- Repository: https://github.com/keverw/diskspace.js
- Homepage: https://github.com/keverw/diskspace.js#readme
- Issues: https://github.com/keverw/diskspace.js/issues
- npm.io page: https://npm.io/package/diskspace

## Recent versions

- 2.0.0 (latest) — 2017-03-17
- 1.0.3 — 2016-05-10
- 1.0.2 — 2015-10-28
- 1.0.1 — 2015-10-28
- 1.0.0 — 2015-10-26
- 0.1.7 — 2014-07-05
- 0.1.6 — 2014-04-04
- 0.1.5 — 2012-05-11
- 0.1.4 — 2012-05-03
- 0.1.3 — 2012-05-03
- 0.1.2 — 2012-05-03
- 0.1.1 — 2012-05-03
- 0.1.0 — 2012-05-03

## README

[![build status](https://secure.travis-ci.org/keverw/diskspace.js.png)](http://travis-ci.org/keverw/diskspace.js)

# diskspace.js 2.0.0
This is a simple module for Node.js to check disk space usage in bytes on both *nix and Windows systems.

If you are using on Windows, This also depends on a console application for Windows called [DriveSpace](https://github.com/keverw/drivespace) written in C# and requires .NET Framework 3.5 when using this on a Windows system. This is included in the NPM package, but you can look at the DriveSpace code also if you wish.

If your on a *nix system, `drivespace.exe` is not used and `df` command is used.

## Setup

To set up diskspace.js on your Node.js server use npm.

`npm install diskspace`

## Example Usage
```
var diskspace = require('diskspace');
diskspace.check('C', function (err, result)
{
	Your code here
});
```
On Windows you change C to the drive letter you want to check. On Linux you use the mount path eg `/`.

The result of the diskspace check is returned as an object named `result`.

* `result.total` is how much the drive has totally.
* `result.used` is how much of the drive is reported as used. On *nix this is straight from the `df -k` command, on Windows it's calculated from `result.total - result.free`
* `result.free` is how much free space you have.
* `result.status` isn't really that useful unless you want to debug.

## Status codes:

- NOTFOUND - Disk was not found, the space values will be 0
- READY - The drive is ready
- NOTREADY - The drive isn't ready, the space values will be 0
- STDERR - some error, the output of it was logged to the console.

## Other Notes
This will fail on hard drives bigger than 9 petabytes. Thanks [@SteveStreza](https://twitter.com/#!/SteveStreza) [[1]](https://twitter.com/#!/SteveStreza/status/197939419842482176) [[2]](https://twitter.com/#!/SteveStreza/status/197939715993907200)

---
_Source: https://npm.io/package/diskspace · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
