diskpart
Run Windows diskpart scripts in NodeJS.
Notice this module requires running with admin privileges. Use modules such as windosu to provide elevation if you require that feature.
Example:
var diskpart = require('diskpart');
diskpart.evaluate([ 'rescan' ], function(error, output) {
if (error) throw error;
console.log(output);
});
Microsoft DiskPart version 6.3.9600
Copyright (C) 1999-2013 Microsoft Corporation.
On computer: DELL
Please wait while DiskPart scans your configuration...
DiskPart has finished scanning your configuration.
Installation
Install diskpart
by running:
$ npm install --save diskpart
Documentation
diskpart.runScript(String scriptPath, Function callback)
Run a diskpart script file.
scriptPath
The path to the script.
callback(error, output)
-
error
is a possible error. -
output
a string containing the output of the command.
Notice that if the command outputs to stderr
, it will be returned wrapped in an Error
instance.
Example:
var diskpart = require('diskpart');
diskpart.runScript('C:\\myDiskpartScript', function(error, output) {
if (error) throw error;
console.log(output);
});
diskpart.evaluate(String[] input, Function callback)
Execute a series of diskpart commands.
input
An array of strings containing diskpart commands.
callback(error, output)
-
error
is a possible error. -
output
a string containing the output of the command.
Notice that if the command outputs to stderr
, it will be returned wrapped in an Error
instance.
Example:
var diskpart = require('diskpart');
diskpart.evaluate([ 'rescan', 'list disk' ], function(error, output) {
if (error) throw error;
console.log(output);
});
Tests
Run the test suite by doing:
$ gulp test
Contribute
- Issue Tracker: github.com/resin-io/diskpart/issues
- Source Code: github.com/resin-io/diskpart
Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:
$ gulp lint
Support
If you're having any problem, please raise an issue on GitHub.
License
The project is licensed under the MIT license.