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.
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);
});
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!');
});
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!');
});
Currently, only Windows 7, 8 & 8.1 have been tested and confirmed to work. On going testing is required.