Obtain information about storage devices.
This module is installed using node package manager (npm):
# This module contains C++ source code which will be compiled
# during installation using node-gyp. A suitable build chain
# must be configured before installation.
npm install storage-device-info
It is loaded using the require()
function:
var storage = require ("storage-device-info");
Storage information can then be obtained:
storage.getPartitionSpace("c:\\", function(error, space) {
console.dir(space);
});
storage.getPartitionSpace("/opt", function(error, space) {
console.dir(space);
});
Currently this module exports only the function getPartitionSpace()
.
The getPartitionSpace()
function obtains space utilisation information for
the partition on which the path
exists.
For example, on Windows, the c:\\temp
directory is located on the c:\\
partition, and so space utilisation information will be obtained for the c:\\
partition.
The callback
function is called once space information has been obtained.
The following arguments will be passed to the callback
function:
error
- Instance of theError
class, ornull
if no error occurredspace
- An object which will have the following attributes:totalMegaBytes
freeMegaBytes
The following example obtains space information for the /
partition on which
the /opt
directory is located:
storage.getPartitionSpace("/opt", function(error, space) {
if (error) {
console.log(error);
} else {
console.log("total: " + space.totalMegaBytes + "\n"
+ "free: " + space.freeMegaBytes + "\n");
}
});
Example programs are included under the modules example
directory.
- Initial release
- Add more keywords to the
package.json
file
- Support MAC OS X
- Unused variables warnings seen during build on MAC OS X
- Support Node.js 0.12.x using the Native Abstractions for Node interface
- Update two missed variable instantiations to use NanNew
- Do not use
uv_last_error()
as it is not available in 0.12, and do not use anduv_err_t
as the types differ between 0.10 and 0.12 due to libuv changes
- Add version dependency "<2.0.0" for the "nan" module to prevent build failures during installation because of breaking API changes
## Version 1.1.4 - 22/09/2015
- Host repository on GitHub
- Support Native Abstractions for Node 2.x
- Require nan 2.3.x to support node version 6
- Support Node.js 10
- Set NoSpaceships Ltd to be the owner and maintainer
- Remove redundant sections from README.md
Copyright (c) 2018 NoSpaceships Ltd [email protected]
Copyright (c) 2014 Stephen Vickers [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Stephen Vickers [email protected]