Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/knutkirkhorn/free-space

💾 Get the amount of free space for a drive
https://github.com/knutkirkhorn/free-space

disk drive free free-space linux macos macosx nodejs space unix windows

Last synced: 1 day ago
JSON representation

💾 Get the amount of free space for a drive

Awesome Lists containing this project

README

        

# free-space

> Get the amount of free space for a drive

## Installation

```
$ npm install @knutkirkhorn/free-space
```

## Usage

```js
const freeSpace = require('@knutkirkhorn/free-space');
const prettyBytes = require('pretty-bytes');

freeSpace().then(bytes => {
console.log('Free space: ' + prettyBytes(bytes));
// => Free space: 39.6 GB
});

freeSpace('c').then(bytes => {
console.log('Free space: ' + prettyBytes(bytes));
// => Free space: 39.6 GB
});
```

## API

### freeSpace()

Returns the amount of free space for the default drive.

### freeSpace(drive)

Returns the amount of free space for a specified `drive`.

## Related

- [system-disk](https://github.com/knutkirkhorn/system-disk) - Get the system disk of the computer (e.g. `C:` or `/dev/sda`)
- [@knutkirkhorn/free-space-cli](https://github.com/knutkirkhorn/free-space-cli) - CLI for this module