refactor data hosting
This commit is contained in:
parent
bf87ac08db
commit
e9502410de
1 changed files with 22 additions and 0 deletions
22
ui/util/diskspace.js
Normal file
22
ui/util/diskspace.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
const { exec } = require('child_process');
|
||||
|
||||
export const diskSpaceLinux = (path) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(`df ${path}`, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`);
|
||||
return reject();
|
||||
}
|
||||
if (stderr) {
|
||||
return reject();
|
||||
}
|
||||
resolve(stdout);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// export diskSpaceWindows = (path) => {
|
||||
// new Promise((resolve, reject) => {
|
||||
//
|
||||
// });
|
||||
// }
|
Loading…
Reference in a new issue