Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/knutkirkhorn/free-space
- Owner: knutkirkhorn
- License: mit
- Created: 2018-01-24T20:28:54.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2023-02-17T12:39:57.000Z (almost 2 years ago)
- Last Synced: 2024-10-13T14:29:08.135Z (about 1 month ago)
- Topics: disk, drive, free, free-space, linux, macos, macosx, nodejs, space, unix, windows
- Language: JavaScript
- Homepage:
- Size: 114 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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