@wwa/statvfs
TypeScript icon, indicating that this package has built-in type declarations

1.1.18 • Public • Published

node-statvfs

This module provides Node.js bindings for the uv_fs_statfs() function.

Example

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);

Readme

Keywords

none

Package Sidebar

Install

npm i @wwa/statvfs

Weekly Downloads

142

Version

1.1.18

License

MIT

Unpacked Size

8.69 kB

Total Files

7

Last publish

Collaborators

  • wwa