node-diskfree

Get used, available and total disk space. This module using 'df -k' for OSX system and 'df' for *nix system.

npm install node-diskfree
2 downloads in the last day
8 downloads in the last week
51 downloads in the last month

node-diskfree - NPM version

NPM

Get used, available and total disk space. This module using 'df -k' for OSX system and 'df' for *nix system.

Installation

npm install node-diskfree

Usage

var df = require('node-diskfree');

/* retrieve disks list */
df.drives(
    function (err, drives) {
        if (err) {
            return console.log(err);
        }

        /* retrieve space information for each drives */
        df.drivesDetail(
            drives,
            function (err, data) {
                if (err) {
                    return console.log(err);
                }

                console.log(data);
            }
        );

        /* or retrieve space information for on drive */
        df.driveDetail(
            drives[0],
            function (err, data) {
                if (err) {
                    return console.log(err);
                }

                console.log(data);
            }
        );
    }
);

Tests

You can run these scripts :

  • to get information about first drive
npm run-script drive
  • to get information about all drives
npm run-script drives

License

See LICENSE.md file.

Change Log

See CHANGE_LOG.md file.

npm loves you