njds.drives( function (err, drives) { njds.drivesDetail( drives, function (err, data) { /* Get drive used percentage */ used_disk = Math.round( 1000 * parseInt(data[0].used) / parseInt(data[0].total) ) / 10; rpi_debug( '[used_disk] ' + data[0].used + ' of ' + data[0].total + ' -> ' + used_disk ); }); })
function (err, drives) { console.log(err); njds.drivesDetail( drives, function (err, data) { var i; console.log(err); // sometimes we get nothing? try { for (i = 0; i < data.length; i += 1) { if (data[i].drive.indexOf('/dev/sda1') > -1) { result(Math.floor(data[i].available.split(' ')[0] / 3.7 * 60)); } } } catch (e) { console.log(e); //error in the above string(in this case,yes)! result(1000); // domt [prevent recording] } } ); }
function (err, drives) { njds.drivesDetail( drives, function (err, data) { for(var i = 0; i<data.length; i++) { // TODO : filtrer ce qui commance par /run if ((data[i].mountpoint.indexOf("/run") > 0) || (data[i].mountpoint.indexOf("/run") == -1)) { disks_data.push([data[i].mountpoint, 100 - data[i].freePer]); disk_widget.setData( { headers: disks_headers, data: disks_data}); } } } ); }
function (err, drives) { njds.drivesDetail( drives, function (err, data) { // pour chaque point de montage... for(var i = 0; i<data.length; i++) { // si le point de montage ne commence pas par /run on ajoute les données au tableau if ((data[i].mountpoint.indexOf("/run") > 0) || (data[i].mountpoint.indexOf("/run") == -1)) { disks_data.push([data[i].mountpoint, 100 - data[i].freePer]); disk_widget.setData( { headers: disks_headers, data: disks_data}); } } } ); }
drivelist.drives(function(error, drives) { // get details drivelist.drivesDetail(drives, function(error, details) { var result = []; details.forEach(function(item) { try { if(fs.lstatSync(item.mountpoint).isDirectory()) { result.push(item); } } catch(e) {} }); result = [{volumename:'Test', available: '1 TB', mountpoint: '/tmp/bla'}]; callback(error, result); }); });