win-eject
v1.0.2
Published
Win-Eject is a binding for DVD and CD drives. It currently only supports Windows and is dependent on VBScript. Inspired by DiscDrive
Downloads
110
Maintainers
Readme
Win-Eject
Win-Eject is a binding for DVD and CD drives. It currently only supports Windows and is dependent on VBScript. Inspired by DiscDrive for OSX & Linux.
Documentation
Drives: function([callback]);
Argument is of type Function
. It is always called upon completion. The argument sent to this callback function is an Object listing available drives.
Example usage:
var winEject = require('win-eject');
// Get list of drives availiable
winEject.drives(function(drives){
console.log(drives);
});
Eject: function([id/mount], [callback]);
First argument can be of type string
. It specifies the mount / ID of the disk drive to eject. If no drive is specified or the string is blank ''
then all drives will be opened.
Second argument is of type Function
. It is always called upon completion. This callback function is optional.
Example usage:
// Eject all available disk drives.
// Note lack of callback (optional)
winEject.eject();
// Eject disk of [drive].
winEject.eject('E:', function() {
console.log('Disc Drive E: ejected!');
});
Close: function([id/mount], [callback]);
First argument is of type string
. It specifies the mount / ID of the disk drive to eject. If no drive is specified or the string is blank ''
then all drives will be closed.
Second argument is of type Function
. It is always called upon completion. This callback function is optional.
Warning: Close is a hacky solution & has smelly code. This is built on a workaround within VBScript to counter a flaw of VBScript. This function will not work on drives which must be manually close (eg. Laptop drives).
Example usage:
// Close all available disk drives.
// Note lack of callback (optional)
winEject.close();
// Close disk of [drive].
winEject.close('E:', function() {
console.log('Disc Drive E: close!');
});
Compatibility
Currently, only Windows 7 has been tested and confirmed to work. On going testing is required.