A library that tells you how much free disk space you have.
- Works on all platform.
- No dependencies and no native libraries.
npm install --save freespace
Type String
The drive letter (for window) or mount point (for *nix) you want to check
Type function
callback function with signture function(err, bytes)
- err -
Error
An error that occured, otherwisenull
- bytes -
number
The number of bytes available
Promise - Resolves with the number of bytes available
Type String
The drive letter (for window) or mount point (for *nix) you want to check
bytes - number
The number of bytes available
Thie function throws on error
const freespace = require('freespace');
freespace.check('/')
.then(bytes => {
console.log(bytes);
})
.catch(e => {
console.error(e);
});
freespace.check('c', (err, bytes) => {
if (err) {
console.error(err);
} else {
console.log(bytes);
}
});
try {
let bytes = freespace.checkSync('d:');
console.log(bytes);
} catch (e) {
console.error(e);
}