New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

jsdf

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsdf

Wrapper for unix df command

latest
Source
npmnpm
Version
0.3.2
Version published
Maintainers
1
Created
Source

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

Keywords

df

FAQs

Package last updated on 16 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts