https://github.com/sjinks/node-statvfs
Wrapper around uv_fs_statfs() function
https://github.com/sjinks/node-statvfs
node node-native-addons statfs statvfs
Last synced: 10 months ago
JSON representation
Wrapper around uv_fs_statfs() function
- Host: GitHub
- URL: https://github.com/sjinks/node-statvfs
- Owner: sjinks
- License: mit
- Created: 2020-10-26T17:13:34.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-03T06:31:58.000Z (12 months ago)
- Last Synced: 2025-03-05T05:02:22.345Z (11 months ago)
- Topics: node, node-native-addons, statfs, statvfs
- Language: C++
- Homepage: https://www.npmjs.com/package/@wwa/statvfs
- Size: 682 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-statvfs
This module provides Node.js bindings for the [`uv_fs_statfs()`](http://docs.libuv.org/en/v1.x/fs.html#c.uv_fs_statfs) function.
# Example
```js
const { statvfs, statvfsSync } = require('@wwa/statvfs');
// Asynchronous API, uses uv_fs_statfs()
statvfs('/').then((stat) => {
console.log('Total space:', stat.blocks * stat.bsize / 1073741824, 'GiB');
console.log('Free space:', stat.bfree * stat.bsize / 1073741824, 'GiB');
console.log('Available space:', stat.bavail * stat.bsize / 1073741824, 'GiB');
console.log('Total inodes:', stat.files);
console.log('Free inodes:', stat.ffree);
});
// Synchronous API (since 1.1.0), uses statvfs()
const stat = statvfsSync('/');
console.log('Total space:', stat.blocks * stat.bsize / 1073741824, 'GiB');
console.log('Free space:', stat.bfree * stat.bsize / 1073741824, 'GiB');
console.log('Available space:', stat.bavail * stat.bsize / 1073741824, 'GiB');
console.log('Total inodes:', stat.files);
console.log('Free inodes:', stat.ffree);
```