diskdrive

OS compatible bindings for various CD/DVD drive utilities with NodeJS (OSX + Linux supported)

Usage no npm install needed!

<script type="module">
  import diskdrive from 'https://cdn.skypack.dev/diskdrive';
</script>

README

DiskDrive

Build Status

DiskDrive NPM

DiskDrive is a cross compatible binding for DVD and CD drives. It currently supports OSX and Linux.

Install

$ npm install diskdrive --save

CLI

$ npm install diskdrive -g
$ diskdrive [mount/id]

Mount / id is the same as the documentation's mount / id.

Documentation

Eject: function([id/mount], [callback(err)]);

First argument can be of type string or int. It specifies the mount / ID of the disk drive to eject.

Second argument is of type Function, which takes an err. If an error occurs ejecting the disk, it will be called with a respective Error. It is always called upon completion (the error will be null).

Example usage:

var diskdrive = require('diskdrive');

// Eject the primary disk drive.
// Note lack of callback (optional)
diskdrive.eject();

// [Mac] Eject disk of [id].
diskdrive.eject(2, function(error) {
    if (error) console.log(error);
});

// [Linux] Eject disk drive, with specified mount.
diskdrive.eject('/dev/dvd', function(error) {
    if (error) console.log(error);
});
diskdrive.eject('dvd'); // appended to /dev/, would result in same system file. (/dev/dvd)

Cross Compatibility

Currently, OSX and Linux have been tested and are confirmed to work. The following have been tested with good results:

  • OSX 10.9.2
  • OSX 10.9.5
  • Ubuntu 12.04

License

MIT