-
Notifications
You must be signed in to change notification settings - Fork 12
getVolumeSpace and getVolumeSpaceSync
xiao edited this page Sep 29, 2021
·
13 revisions
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.
async:
fswin.getVolumeSpace(path, callback);
sync:
var result = fswin.getVolumeSpaceSync(volume);
-
path
is the root path of a volume. -
callback
is a function to make callback with. it takes only one argumentresult
. -
result
is an object that contains to properties:TOTAL
andFREE
.
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');