package
A node.js binding to useful system-level functions
npm install xsysGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
A node.js binding to useful system-level functions.
npm install xsys
var fs = require('xsys').fs;
// format our numerical output
function fmtBytes(val) {
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
fs.getTotal(function(err, n) {
if (err) throw err;
console.log('Total bytes for current volume: ' + fmtBytes(n));
});
fs.getFree(function(err, n) {
if (err) throw err;
console.log('Free bytes for current volume: ' + fmtBytes(n));
});
fs.getUsed(function(err, n) {
if (err) throw err;
console.log('Used bytes for current volume: ' + fmtBytes(n));
});
// sample output:
//
// Total bytes for current volume: 974,656,999,424
// Free bytes for current volume: 877,061,001,216
// Used bytes for current volume: 48,814,333,952fs.getTotal([<String>path,] <Function>callback) - (void) - Retrieves the number of total bytes on the volume where path is located (defaults to path of the module). The callback receives two arguments: an <Error> object in case of error (null otherwise) and a <String> containing the number of bytes.
fs.getTotalSync([<String>path]) - <String> - Synchronous version of getTotal().
fs.getFree([<String>path,] <Function>callback) - (void) - Retrieves the number of free bytes on the volume where path is located (defaults to path of the module). The callback receives two arguments: an <Error> object in case of error (null otherwise) and a <String> containing the number of bytes.
fs.getFreeSync([<String>path]) - <String> - Synchronous version of getFree().
fs.getUsed([<String>path,] <Function>callback) - (void) - Retrieves the number of used bytes on the volume where path is located (defaults to path of the module). The callback receives two arguments: an <Error> object in case of error (null otherwise) and a <String> containing the number of bytes.
fs.getUsedSync([<String>path]) - <String> - Synchronous version of getUsed().