Node-disk is a C++ addon node.js module for get physical disk information. Now it support windows platform, will support linux & macOS soon.
npm install node-disk --save
const disk = require('node-disk');
const info = disk.getDisk((err, data) => {
//data is disk information
});
//or invoke like this
disk.getDisk().then((data) => {
//support promise or async/await
}).catch((err) => {
//error info
});
//or query by volumes
disk.getDisk('C:', (err, data) => { });
//or like this, it's ok to pass a single letter, since it just compare first letter in windows
(async () => {
let info = await disk.getDisk('D');
})()
Disk information includes total and free size of disk currently. Plan to implement other info in future.
{
total: '1042.04 GB',
free: '781.00 GB',
volumes: [{
name: 'C:\\',
total: '78.74 GB',
free: '31.18 GB'
}
]
}
- Support linux and macOS
- Get more info about hardware
- Refector by using nan(Native Abstractions for Node.js)
- Add docs and mocha test cases
Copyright (c) 2018 Code2Life Node-disk is licensed under an MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.