win-eject
Version:
Win-Eject is a binding for DVD and CD drives. It currently only supports Windows and is dependent on VBScript. Inspired by DiscDrive
19 lines (17 loc) • 770 B
JavaScript
var exec = require('child_process').exec;
function execute(command, callback){
exec(command, function(error, stdout, stderr){ callback(stdout); });
};
module.exports.drives = function(callback){
execute("Cscript //nologo node_modules/win-eject/drivehack.vbs",function(json){
callback(JSON.parse(json));
});
};
module.exports.eject = function(drive,callback){
drive = ' '+drive || ''; callback=callback||function(){};
execute("Cscript //nologo node_modules/win-eject/drivehack.vbs open"+drive,callback);
};
module.exports.close = function(drive,callback){
drive = ' '+drive || ''; callback=callback||function(){};
execute("Cscript //nologo node_modules/win-eject/drivehack.vbs close"+drive,callback);
};