-
-
Notifications
You must be signed in to change notification settings - Fork 12
getVolumeSpace
xiao edited this page Nov 8, 2025
·
1 revision
get the total space and free space of a volume for the current user. which means the result can be different from the physical space when disk quota is enabled.
callback:
fswin.getVolumeSpace(path, callback);async:
var result = await fswin.getVolumeSpaceAsync(volume);sync:
var result = fswin.getVolumeSpaceSync(volume);-
pathis the root path of a volume. -
callbackis a function that takes only one argumentresult. -
resultis an object that contains 2 properties:TOTALandFREEor null when the volume is inaccessible.
var fswin = require('fswin');
var path = 'c:\\';
//sync
var result = fswin.getVolumeSpaceSync(path);
console.log('total space is: ' + result.TOTAL + ' Bytes, free sapce is' + result.FREE + ' Bytes.');
//async
console.log(fswin.getVolumeSpace(path, function (result) {
console.log('total space is: ' + result.TOTAL + ' Bytes, free sapce is' + result.FREE + ' Bytes.');
}) ? 'job queued' : 'failed to queue job');