https://github.com/alex-d/check-disk-space
Light multi-platform disk space checker without third-party for Node.js
https://github.com/alex-d/check-disk-space
disk-space disk-usage nodejs npm-package
Last synced: 10 months ago
JSON representation
Light multi-platform disk space checker without third-party for Node.js
- Host: GitHub
- URL: https://github.com/alex-d/check-disk-space
- Owner: Alex-D
- License: mit
- Created: 2017-09-29T01:56:15.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T00:51:10.000Z (about 2 years ago)
- Last Synced: 2025-04-03T20:12:50.415Z (10 months ago)
- Topics: disk-space, disk-usage, nodejs, npm-package
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/check-disk-space
- Size: 788 KB
- Stars: 104
- Watchers: 9
- Forks: 25
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Check disk space
[](https://github.com/Alex-D/check-disk-space/actions/workflows/ci.yml)
[](https://www.npmjs.com/package/check-disk-space)
[](LICENSE)
## Introduction
Light multi-platform disk space checker without third party for Node.js.
- Works on Linux, macOS and Windows
- Take care of mounting points on unix-like systems
- No dependencies
- TypeScript support
## Install
`npm install check-disk-space`
## Usage
```js
// ES
import checkDiskSpace from 'check-disk-space'
// CommonJS
const checkDiskSpace = require('check-disk-space').default
// On Windows
checkDiskSpace('C:/blabla/bla').then((diskSpace) => {
console.log(diskSpace)
// {
// diskPath: 'C:',
// free: 12345678,
// size: 98756432
// }
// Note: `free` and `size` are in bytes
})
// On Linux or macOS
checkDiskSpace('/mnt/mygames').then((diskSpace) => {
console.log(diskSpace)
// {
// diskPath: '/',
// free: 12345678,
// size: 98756432
// }
// Note: `free` and `size` are in bytes
})
```