Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including diskusage-ng with all npm packages installed. Try it out:

var diskusageNg = require("diskusage-ng")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

diskusage-ng v0.2.4

Get disk usage info in pure JS via OS built-in tools

diskusage-ng - get disk usage info in pure JavaScript and without any dependencies

Build Status

Supported operating systems:

  • Windows (via WMIC)
  • OSX/Linux/Posix (via df)

Usage

var diskusage = require('diskusage-ng');

diskusage('/home/me', function(err, usage) {
    if (err) return console.log(err);

    console.log(usage.total);
    console.log(usage.used);
    console.log(usage.available);
});

Posix notes

Filenames with " inside will be rejected with an explicit error. Bash substitution works, so for example diskusage('$HOME', ...) will show a diskusage for the user's home dir. It means that passing a raw user input to diskusage() can lead to arbitrary code execution.

Commands

npm run test
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free