0.3.2 • Published 6 years ago

jsdf v0.3.2

Weekly downloads
8
License
ISC
Repository
github
Last release
6 years ago

npm Package Build Status Coverage Status

Installation

jsdf is published on npm

npm install --save jsdf

User Guide

const df = require('jsdf');

df('.', (err, out) => {
  console.log(out);
});

Should produce output (depending on your filesystem) similar to:

{ '/': 
   { filesystem: '/dev/sda1',
     blocks: 245084444,
     used: 54700392,
     available: 177864784,
     fill: 0.24 } }

API

jsdf module exports single function

jsdf(options, done)

options argument is optional. If it's omitted df will return statistics for all available file systems, with default formatting. If argument is a string, it will be considered as a path specifying filesystem to be checked. Otherwise jsdf expects an object with following optional parameters:

OptionTypeDescription
pathStringPath passed to df, command specifying filesystem to be checked
baseStringBase size unit used for output formatting. Can be G, M or K (GB, MB or KB - default)
decimalsNumberNumber of decimal places for output size rounding

done is a callback function that will be invoked with formatted output of df command. Expected signature follows a standard error first pattern: done(error, output). If no error occurred, output should be a dictionary object with following structure:

TypeDescription
keyStringMounting point of a filesystem
valueObjectDetails of the filesystem size
value.filesystemStringFilesystem name
value.blocksNumberTotal size of filesystem blocks (unit depends on formatting)
value.usedNumberSize of used filesystem blocks (unit depends on formatting)
value.availableNumberSize of available filesystem blocks (unit depends on formatting)
value.fillNumberFilesystem fill ratio
df({path: '.', base: 'G', decimals: '3'}, (err, out) => {
  console.log(out);
});
0.3.2

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago